[PATCH] D119136: [clang] Implement Change scope of lambda trailing-return-type
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 12 07:58:18 PDT 2022
aaron.ballman 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:
> cor3ntin wrote:
> > aaron.ballman wrote:
> > >
> > That doesn't work
> >
> > ```
> > [a]<typename x = decltype(a)>(decltype(a) )
> > ^ nope ^ double nope
> > ```
> It looks like this comment may have been missed.
Thank you for this! I think we should go with %select to name where it cannot be used. e.g., `cannot be used in a lambda %select{parameter list|template parameter list|whatever}1`
================
Comment at: clang/test/SemaCXX/lambda-capture-type-deduction.cpp:61
+ ();
+ [x]() requires is_same<const int &, decltype((x))> {}
+ ();
----------------
Can you also add test coverage for when the `requires` comes *before* the parens as in: `[x] requires(is_same<const int &, decltype((x))>)(){}();`?
I think you should also look at the grammar for lambda-expression to make sure we're not missing other coverage (use in attributes also appears to be untested).
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