aaron.ballman added a comment. Please keep in mind that I don't have a lot of expertise in modules, but this sure seems like a module merging bug from what I can tell, and it might even relate to work happening in D145737 <https://reviews.llvm.org/D145737> (CC @rsmith). That patch does not seem to address this issue, but what I'm seeing when I try to debug this is a bit confusing to me:
In the reproducer from Sam, there are three lambdas: `create::Create<R>([] {});` in `main.cpp`, but this does not participate in AST merging because it's within the main source file `BuildWidget<T>([dummy](Widget<T>*) {});` in `create.h` `create::Create<float>([] {});` in `instantiate_create.h` (While `wrap_create.h` includes `create.h`, it never instantiates the template and so should not produce an additional lambda) So I would expect `ASTDeclReader::ReadCXXDefinitionData()` to find three lambdas, but it finds *four*. The first lambda it reads has no captures, so this is presumably the one in `instantiate_create.h`. The next three all have captures. So where's that fourth lambda coming from? The reason I think this relates is because `LocalInstantiationScope::findInstantiationOf()` seems to think there's one declaration in the local scope, but the argument passed to the function is not the one found, which suggest to me there's a module merging issue and we wind up hitting our favorite assert. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124351/new/ https://reviews.llvm.org/D124351 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits