[clang] [Clang][Sema] Create Local Scope for Variable Template (PR #228280)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 19:54:23 PDT 2026


================
@@ -6355,6 +6355,10 @@ VarTemplateSpecializationDecl *Sema::BuildVarTemplateInstantiation(
   if (Inst.isInvalid())
     return nullptr;
 
+  // A variable template specialization is never a local declaration, so it
+  // must not see the locals of whatever instantiation we are currently in.
+  LocalInstantiationScope Local(*this);
----------------
aokblast wrote:

It still make sense. From standard, local means inside a blcok (fucntion). A class  in this case will be bypassed by FindInstantiatedDecl. There is a common in that function:
```
// D is a local of some kind. Look into the map of local
// declarations to their instantiations.
```

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


More information about the cfe-commits mailing list