===================================================================
@@ -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. */
===================================================================
@@ -4,7 +4,7 @@
char a[1];
int foo(a = "") // { dg-error "invalid array assignment" }
-{ // { dg-error "" }
+{
return 0;
}
===================================================================
@@ -0,0 +1,4 @@
+// PR c++/52987
+
+int foo(x a) { // { dg-error "9:'x' was not declared in this scope" }
+}