llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: None (llvmbot) <details> <summary>Changes</summary> Backport c7daab2 Requested by: @<!-- -->zyn0217 --- Full diff: https://github.com/llvm/llvm-project/pull/136283.diff 2 Files Affected: - (modified) clang/lib/Parse/ParseExpr.cpp (-3) - (modified) clang/test/Parser/recovery.cpp (+18) ``````````diff diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 0cadede51a9b3..2fab1dfed4a00 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -2237,8 +2237,6 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { if (PP.isCodeCompletionReached() && !CalledSignatureHelp) RunSignatureHelp(); LHS = ExprError(); - } else if (!HasError && HasTrailingComma) { - Diag(Tok, diag::err_expected_expression); } else if (LHS.isInvalid()) { for (auto &E : ArgExprs) Actions.CorrectDelayedTyposInExpr(E); @@ -3738,7 +3736,6 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr *> &Exprs, if (Tok.is(tok::r_paren)) { if (HasTrailingComma) *HasTrailingComma = true; - break; } } if (SawError) { diff --git a/clang/test/Parser/recovery.cpp b/clang/test/Parser/recovery.cpp index 2fce67a52c6b6..261f5dc99bad4 100644 --- a/clang/test/Parser/recovery.cpp +++ b/clang/test/Parser/recovery.cpp @@ -222,3 +222,21 @@ void k() { func(1, ); // expected-error {{expected expression}} } } + +namespace GH136254 { + +void call() { + [a(42, )]() {} (); // expected-error {{expected expression}} + + int *b = new int(42, ); // expected-error {{expected expression}} + + struct S { + int c; + + S() : c(42, ) {} // expected-error {{expected expression}} + }; + + int d(42, ); // expected-error {{expected expression}} +} + +} `````````` </details> https://github.com/llvm/llvm-project/pull/136283 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits