[clang] [Sema] Don't call isNonConstantStorage on incomplete variable types (PR #161590)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 3 11:15:33 PDT 2025


================
@@ -14919,7 +14919,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
 
   // Apply section attributes and pragmas to global variables.
   if (GlobalStorage && var->isThisDeclarationADefinition() &&
-      !inTemplateInstantiation()) {
+      !var->getDeclContext()->isDependentContext()) {
----------------
shafik wrote:

To fill in some details, it is more consistent and it is cheaper since `isDependentContext()` looks at all the parent contexts recursively. 

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


More information about the cfe-commits mailing list