================
@@ -294,6 +294,13 @@ Sema::getCurrentMangleNumberContext(const DeclContext *DC) 
{
   bool IsInNonspecializedTemplate =
       inTemplateInstantiation() || CurContext->isDependentContext();
 
+  // If we must allocate mangling numbers but the `ManglingContextDecl`
+  // is a local variable, use the `DeclContext` containing the lambda 
expression
+  // instead.
+  if (VarDecl *Var = dyn_cast_or_null<VarDecl>(ManglingContextDecl);
+      Var && Var->isLocalVarDecl())
+    ManglingContextDecl = const_cast<Decl *>(cast<Decl>(DC));
----------------
jiixyj wrote:

Good idea, I refactored the check so that is only applies in the modules case.

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

Reply via email to