rsmith added a comment. Hm, do we ever call `FindInstantiatedDecl` on a lambda class in the first place? It seems plausible to me that this condition is unreachable. But to the extent that it's reachable, it seems mostly correct: a lambda expression appearing in a non-dependent context might still be dependent (for example, it could be a lambda in the initializer of a variable template), and in that case, it should be found in the local instantiation scope. I think it's not quite correct in that case, though: we should expect to find the closure type in the local instantiation scope only if its template depth (`D->getTemplateDepth()`) is greater than the number of outer retained template levels. In fact, we could change `ParentDependsOnArgs` to do that check in general (`Decl::getTemplateDepth` didn't exist when `ParentDependsOnArgs` was written).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99134/new/ https://reviews.llvm.org/D99134 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits