aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseExpr.cpp11
-rw-r--r--test/Parser/expressions.c9
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 6713ca920e..ebba576643 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -851,15 +851,20 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
}
// Match the ')'.
- if (!LHS.isInvalid() && Tok.is(tok::r_paren)) {
+ if (Tok.isNot(tok::r_paren)) {
+ MatchRHSPunctuation(tok::r_paren, Loc);
+ return ExprError();
+ }
+
+ if (!LHS.isInvalid()) {
assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
LHS = Actions.ActOnCallExpr(CurScope, move(LHS), Loc,
move_arg(ArgExprs), &CommaLocs[0],
Tok.getLocation());
}
-
- MatchRHSPunctuation(tok::r_paren, Loc);
+
+ ConsumeParen();
break;
}
case tok::arrow: // postfix-expression: p-e '->' identifier
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c
index 3f58ef3d51..2b4d4636eb 100644
--- a/test/Parser/expressions.c
+++ b/test/Parser/expressions.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -parse-noop %s
+// RUN: clang-cc -parse-noop -verify %s
void test1() {
if (sizeof (int){ 1}); // sizeof compound literal
@@ -41,3 +41,10 @@ int test_leading_extension() {
__extension__ (*(char*)0) = 1;
}
+// PR3972
+int test5(int);
+int test6(void) {
+ return test5( // expected-note {{to match}}
+ test5(1)
+ ; // expected-error {{expected ')'}}
+}