[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:42:28 PDT 2021


rsmith added a comment.

Ah, I think I see how we get here. I think this fix might possibly break a case such as:

  template<typename T> int x = [](auto){ return T(); }.operator()(T());
  int y = x<int>;

... where transforming the call to `operator()` might end up looking for the transformed version of the lambda class; we need to find that in the local instantiation scope.

I think we want something like `isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isDependentLambda() && cast<CXXRecordDecl>(D)->getTemplateDepth() > TemplateArgs.getNumRetainedOuterLevels()`. (But I wonder if we can clean this up by switching to always checking the template depth of `D` rather than sometimes checking the parent's template depth.)


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