OSDN Git Service

PR c++/20646
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Aug 2005 00:20:32 +0000 (00:20 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Aug 2005 00:20:32 +0000 (00:20 +0000)
* decl.c (grokdeclarator): Reset storage_class after error.

* g++.dg/other/mult-stor1.C: New test.

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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/mult-stor1.C [new file with mode: 0644]

index f8ca474..0aa5d7b 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-10  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/20646
+       * decl.c (grokdeclarator): Reset storage_class after error.
+
 2005-08-08  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/22508
index 99a1830..e2bd165 100644 (file)
@@ -7064,7 +7064,10 @@ grokdeclarator (const cp_declarator *declarator,
   /* Warn about storage classes that are invalid for certain
      kinds of declarations (parameters, typenames, etc.).  */
   if (declspecs->multiple_storage_classes_p)
-    error ("multiple storage classes in declaration of %qs", name);
+    {
+      error ("multiple storage classes in declaration of %qs", name);
+      storage_class = sc_none;
+    }
   else if (thread_p
           && ((storage_class
                && storage_class != sc_extern
index ddaeed3..774b0b8 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-10  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/20646
+       * g++.dg/other/mult-stor1.C: New test.
+
 2005-08-09  Andrew Pinski  <pinskia@physics.uc.edu>
 
        * gcc.c-torture/pr18299-1.c: Move to ...
diff --git a/gcc/testsuite/g++.dg/other/mult-stor1.C b/gcc/testsuite/g++.dg/other/mult-stor1.C
new file mode 100644 (file)
index 0000000..439c0cb
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/20646
+// Origin: Dan Rosen <dan.rosen@gmail.com>
+// { dg-do compile }
+
+struct A
+{
+  extern static int i;  // { dg-error "multiple storage classes" }
+};