/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Jul 2015 10:11:48 +0000 (10:11 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Jul 2015 10:11:48 +0000 (10:11 +0000)
2015-07-23  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/52987
* parser.c (cp_parser_simple_declaration): Robustify check avoiding
redundant error messages.

/testsuite
2015-07-23  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/52987
* g++.dg/parse/error57.C: New.
* g++.dg/expr/string-2.C: Update.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226097 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/expr/string-2.C
gcc/testsuite/g++.dg/parse/error57.C [new file with mode: 0644]

index bb0385d..7626492 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-23  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/52987
+       * parser.c (cp_parser_simple_declaration): Robustify check avoiding
+       redundant error messages.
+
 2015-07-21  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * decl.c (grokdeclarator): For an erroneous template parameter
index f1d5656..920cb61 100644 (file)
@@ -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 20fad26..fe273a8 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-23  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/52987
+       * g++.dg/parse/error57.C: New.
+       * g++.dg/expr/string-2.C: Update.
+
 2015-07-23  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/66945
index 252fa70..224fd61 100644 (file)
@@ -4,7 +4,7 @@
 char a[1];
 
 int foo(a = "") // { dg-error "invalid array assignment" }
-{ // { dg-error "" }
+{
   return 0;
 }
 
diff --git a/gcc/testsuite/g++.dg/parse/error57.C b/gcc/testsuite/g++.dg/parse/error57.C
new file mode 100644 (file)
index 0000000..8325a0c
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/52987
+
+int foo(x a) {  // { dg-error "9:'x' was not declared in this scope" }
+}