[PATCH] D119136: [clang] Implement Change scope of lambda trailing-return-type

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 06:31:42 PDT 2022


cor3ntin added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:7702
+  def err_lambda_used_before_capture: Error<
+    "captured variable %0 cannot appear before the end of the lambda's parameter list">;
   def note_lambda_variable_capture_fixit : Note<
----------------
aaron.ballman wrote:
> 
That doesn't work

```
[a]<typename x = decltype(a)>(decltype(a) )
                      ^ nope            ^ double nope
```


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:1259
   Actions.PushLambdaScope();
+  Actions.ActOnLambdaIntroducer(Intro, getCurScope());
 
----------------
aaron.ballman wrote:
> This call surprises me here -- I would expect to see this called from `ParseLambdaIntroducer()` so that anyone who parses a lambda introducer gets the action.
This is preexisting that sema for the introducer was done in this function.
The only thing that change is that we are doing it before parsiong the parameter instead of after, in the same action.
And we need to do it here, because of the scope introduction


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119136/new/

https://reviews.llvm.org/D119136



More information about the cfe-commits mailing list