diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 218e18f3ad79..0c6f3c6037e9 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -1260,7 +1260,6 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { if (Tok.isNot(tok::r_paren)) { if (ParseExpressionList(ArgExprs, CommaLocs, &Sema::CodeCompleteCall, LHS.get())) { - SkipUntil(tok::r_paren); LHS = ExprError(); } } diff --git a/clang/test/Parser/parenthesis-balance.cpp b/clang/test/Parser/parenthesis-balance.cpp new file mode 100644 index 000000000000..5bfa6396039a --- /dev/null +++ b/clang/test/Parser/parenthesis-balance.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +int f(int x) { + if (int foo = f(bar)) {} // expected-error{{use of undeclared identifier 'bar'}} + while (int foo = f(bar)) {} // expected-error{{use of undeclared identifier 'bar'}} + for (int foo = f(bar);;) {} // expected-error{{use of undeclared identifier 'bar'}} + + int bar; + if (int foo = f(bar)) {} + while (int foo = f(bar)) {} + for (int foo = f(bar);;) {} + + return 0; +} + diff --git a/clang/test/SemaCXX/copy-assignment.cpp b/clang/test/SemaCXX/copy-assignment.cpp index f3dadc445040..7aca9d6a80ab 100644 --- a/clang/test/SemaCXX/copy-assignment.cpp +++ b/clang/test/SemaCXX/copy-assignment.cpp @@ -99,15 +99,17 @@ void test() { // : Don't crash // FIXME: the recovery here is really bad. -namespace test1 { // expected-note{{to match this '{'}} - template class A : public unknown::X { // expected-error {{undeclared identifier 'unknown'}} expected-error {{expected class name}} \ - // expected-note{{template parameter is declared here}} +namespace test1 { + template class A : public unknown::X { // expected-error {{undeclared identifier 'unknown'}} expected-error {{expected class name}} A(UndeclaredType n) : X(n) {} // expected-error{{expected ')'}} expected-note{{to match this '('}} \ - // expected-error{{use of undeclared identifier 'n'}} + // expected-error{{use of undeclared identifier 'n'}} \ + // expected-error{{expected ';' at end of declaration list}} \ + // expected-error{{field has incomplete type 'test1::A'}} }; - template class B : public A { // expected-error{{declaration of 'T' shadows template parameter}} + template class B : public A { virtual void foo() {} }; - extern template class A; // expected-error{{expected member name or ';' after declaration specifiers}} - extern template class B; // expected-error{{expected member name or ';' after declaration specifiers}} -} // expected-error{{expected ';' after class}} // expected-error{{expected '}'}} + extern template class A; // expected-note {{in instantiation of template class 'test1::A' requested here}} \ + // expected-note {{definition of 'test1::A' is not complete until the closing '}'}} + extern template class B; +}