================
@@ -14127,6 +14093,15 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr 
*Init, bool DirectInit) {
     return;
   }
 
+  // handleAliasAttr() runs before the initializer is attached to the VarDecl,
+  // so it cannot determine that an extern declaration with an initializer is a
+  // definition. Diagnose the conflict now that an initializer is present and
----------------
keepyixiao wrote:

Thanks. @AaronBallman, what do you think about @efriedma-quic's interpretation 
that a static member variable with an alias attribute should itself be 
considered a definition?

If we follow that interpretation, then the out-of-line int S::i = 12; should 
presumably be diagnosed as a redefinition.

My thought is that the current patch should remain focused on fixing the 
assertion/crash caused by the alias handling. The redefinition diagnostic seems 
like a separate issue, so I could address that in a follow-up patch.

Would that approach make sense to you?

https://github.com/llvm/llvm-project/pull/223124
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to