[clang] [Clang] Fix parsing of expressions of the form (T())[/*...*/] (PR #140053)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Fri May 16 02:35:29 PDT 2025
================
@@ -692,6 +692,86 @@ ExprResult Parser::ParseLambdaExpression() {
return ParseLambdaExpressionAfterIntroducer(Intro);
}
+bool Parser::IsLambdaAfterTypeCast() {
+ assert(getLangOpts().CPlusPlus && Tok.is(tok::l_square) &&
+ "Not at the start of a possible lambda expression.");
+ RevertingTentativeParsingAction TPA(*this);
+ ConsumeBracket();
+ // skip the introducer
+ if (Tok.is(tok::equal) ||
+ (Tok.is(tok::amp) && NextToken().isOneOf(tok::comma, tok::r_square)))
+ return true;
+
+ SkipUntil(tok::r_square);
+
+ auto IsLambdaKWOrAttribute = [&]() {
+ // These are keyworks that can appear somewhere in a lambda declarator,
----------------
Fznamznon wrote:
```suggestion
// These are keywords that can appear somewhere in a lambda declarator,
```
https://github.com/llvm/llvm-project/pull/140053
More information about the cfe-commits
mailing list