[clang] [Clang][Modules] Fix generic lambda local capture mapping mismatch in template instantiation (PR #202248)
James Y Knight via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 8 07:15:04 PDT 2026
https://github.com/jyknight commented:
FTR, running the provided test with current clang results in the following assertion error:
```
clang: clang/lib/Sema/SemaTemplateInstantiate.cpp:4772: llvm::PointerUnion<Decl *, LocalInstantiationScope::DeclArgumentPack *> *clang::LocalInstantiationScope::findInstantiationOf(const Decl *): Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"' failed.
```
I'm not really knowledgeable enough about Clang AST to appropriately review this change, but I commented on one problem in it.
I also note that this depends on the imported functions always having exactly the same local decls within the function body, so that mapping by index can work. I _think_ that is correct to assume, since we do ODR hashing of the ASTs on imports and raise an error if they mismatch. But seemed worth pointing out explicitly, in case there's some edge case where that isn't true I don't know about. (And the existing mapping only happens on params, which I think are _more_ guaranteed-equal.)
https://github.com/llvm/llvm-project/pull/202248
More information about the cfe-commits
mailing list