[PATCH] D99134: Lambdas are not necessarily locals. This resolves DR48250.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 22 20:32:26 PDT 2021


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



More information about the cfe-commits mailing list