[clang] [Clang] Avoid assertion failure for initialized extern aliases (PR #223124)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 07:51:02 PDT 2026


================
@@ -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
----------------
AaronBallman wrote:

Yeah, Eli and I were in agreement; the alias attribute makes it a definition rather than a declaration. I think these are related issues though and probably should be handled together. But I don't insist; this is still forward progress even if it doesn't solve all the issues, but if you elect not to solve it, please be sure to file an issue so we track the bug.

https://github.com/llvm/llvm-project/pull/223124


More information about the cfe-commits mailing list