re PR c++/17393 ("unused variable '._0'" warning with -Wall)
authorMark Mitchell <mark@codesourcery.com>
Sun, 10 Oct 2004 21:49:27 +0000 (21:49 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 10 Oct 2004 21:49:27 +0000 (21:49 +0000)
PR c++/17393
* decl.c (grokdeclarator): Robustify error-recovery on invalid
declarations.

PR c++/17393
* g++.dg/parse/error21.C: New test.

From-SVN: r88855

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/error21.C [new file with mode: 0644]

index 3d7d740..65abf7d 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/17393
+       * decl.c (grokdeclarator): Robustify error-recovery on invalid
+       declarations.
+
 2004-10-10  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        Convert diagnostics to use quoting flag q 7/n
index fa50faa..f077566 100644 (file)
@@ -7765,7 +7765,7 @@ grokdeclarator (const cp_declarator *declarator,
           && ! bitfield)
     {
       error ("abstract declarator %qT used as declaration", type);
-      unqualified_id = make_anon_name ();
+      return error_mark_node;
     }
 
   /* Only functions may be declared using an operator-function-id.  */
index 3ec98ce..d17818f 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/17393
+       * g++.dg/parse/error21.C: New test.
+
 2004-10-10  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        * g++.dg/overload/pmf1.C: Adjust quoting marks.
diff --git a/gcc/testsuite/g++.dg/parse/error21.C b/gcc/testsuite/g++.dg/parse/error21.C
new file mode 100644 (file)
index 0000000..6e24ae2
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/17393
+// { dg-options "-Wall" }
+
+struct A { };
+
+void foo()
+{
+  // Check that we do not complain about an unused
+  // compiler-generated variable.
+  A& = a; // { dg-error "token|declarator|not declared" }
+}
+