[clang] [Clang][Sema] Tweak tryCaptureVariable for unevaluated lambdas (PR #93206)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 3 02:52:51 PDT 2024
================
@@ -1576,7 +1576,10 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
TrailingReturnTypeLoc, &DS),
std::move(Attributes), DeclEndLoc);
- Actions.ActOnLambdaClosureQualifiers(Intro, MutableLoc);
+ // We have called ActOnLambdaClosureQualifiers for parentheses-less cases
----------------
zyn0217 wrote:
> Yes, we need to set whether the lambda has a mutable keyword as soon as the parameters, if present, are parsed, as that affect the meaning of subsequent id-expressions
> When there are no parens, there can be a noexcept clause for example, and parsing that does requires knowing whether the lambda is mutable, so that we can adjust the type of any reference-to-capture.
Thanks, that makes sense! We currently set `LSI->Mutable` in `ActOnLambdaClosureQualifiers()` , and while I think it's possible to move it out of the function, I'm not opposed to leaving it as-is.
https://github.com/llvm/llvm-project/pull/93206
More information about the cfe-commits
mailing list