[clang] [Clang] Avoid assertion failure for initialized extern aliases (PR #223124)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 23 06:29:46 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:
I think for this case it would make sense on redeclaration merging. CC @erichkeane in case he has better ideas because this is starting to spread the checking out an awful lot.
`Sema::FinalizeDeclaration()` is another place to consider, but I suspect it may be similar to adding the logic to `AddInitializerToDecl()`...
https://github.com/llvm/llvm-project/pull/223124
More information about the cfe-commits
mailing list