Index: cp/parser.c =================================================================== --- cp/parser.c (revision 226075) +++ cp/parser.c (working copy) @@ -11660,7 +11660,8 @@ cp_parser_simple_declaration (cp_parser* parser, { /* If we have already issued an error message we don't need to issue another one. */ - if (decl != error_mark_node + if ((decl != error_mark_node + && DECL_INITIAL (decl) != error_mark_node) || cp_parser_uncommitted_to_tentative_parse_p (parser)) cp_parser_error (parser, "expected %<,%> or %<;%>"); /* Skip tokens until we reach the end of the statement. */ Index: testsuite/g++.dg/expr/string-2.C =================================================================== --- testsuite/g++.dg/expr/string-2.C (revision 226075) +++ testsuite/g++.dg/expr/string-2.C (working copy) @@ -4,7 +4,7 @@ char a[1]; int foo(a = "") // { dg-error "invalid array assignment" } -{ // { dg-error "" } +{ return 0; } Index: testsuite/g++.dg/parse/error57.C =================================================================== --- testsuite/g++.dg/parse/error57.C (revision 0) +++ testsuite/g++.dg/parse/error57.C (working copy) @@ -0,0 +1,4 @@ +// PR c++/52987 + +int foo(x a) { // { dg-error "9:'x' was not declared in this scope" } +}