[clang] [Clang][Modules] Fix generic lambda local capture mapping mismatch in template instantiation (PR #202248)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 19:46:29 PDT 2026


================
@@ -3454,9 +3454,21 @@ uint64_t ASTWriter::WriteDeclContextLexicalBlock(ASTContext &Context,
   if (DC->decls_empty())
     return 0;
 
-  // In reduced BMI, we don't care the declarations in functions.
-  if (GeneratingReducedBMI && DC->isFunctionOrMethod())
-    return 0;
+  // In reduced BMI, we don't care the declarations in functions, unless they
+  // are templated functions, because their bodies may contain nested class/lambda
----------------
ChuanqiXu9 wrote:

I am not satisfying with this... this is too broad.  Maybe we need to figure out in such cases what declarations is needed for the lexical lookup. 

I don't feel the fix here is correct.

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


More information about the cfe-commits mailing list