Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions clang/lib/Parse/ParseExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -3738,7 +3736,6 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
if (Tok.is(tok::r_paren)) {
if (HasTrailingComma)
*HasTrailingComma = true;
break;
}
}
if (SawError) {
Expand Down
18 changes: 18 additions & 0 deletions clang/test/Parser/recovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
}

}
Loading