OSDN Git Service

cp/
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Oct 2007 09:57:12 +0000 (09:57 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Oct 2007 09:57:12 +0000 (09:57 +0000)
2007-10-26  Paolo Carlini  <pcarlini@suse.de>

PR c++/31747
* decl.c (grokdeclarator): In case of conflicting specifiers
just return error_mark_node.

testsuite/
2007-10-26  Paolo Carlini  <pcarlini@suse.de>

PR c++/31747
* g++.dg/parse/crash39.C: New.

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

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

index b4edd88..e345e75 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-26  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/31747
+       * decl.c (grokdeclarator): In case of conflicting specifiers
+       just return error_mark_node.
+
 2007-10-26  Ollie Wild  <aaw@google.com>
 
        * expr.c (cxx_expand_expr): Removed.
index 136c8df..9bab97b 100644 (file)
@@ -7552,6 +7552,12 @@ grokdeclarator (const cp_declarator *declarator,
       return error_mark_node;
     }
 
+  if (declspecs->conflicting_specifiers_p)
+    {
+      error ("conflicting specifiers in declaration of %qs", name);
+      return error_mark_node;
+    }
+
   /* Extract the basic type from the decl-specifier-seq.  */
   type = declspecs->type;
   if (type == error_mark_node)
@@ -7846,15 +7852,10 @@ grokdeclarator (const cp_declarator *declarator,
       error ("multiple storage classes in declaration of %qs", name);
       thread_p = false;
     }
-  if (declspecs->conflicting_specifiers_p)
-    {
-      error ("conflicting specifiers in declaration of %qs", name);
-      storage_class = sc_none;
-    }
-  else if (decl_context != NORMAL
-          && ((storage_class != sc_none
-               && storage_class != sc_mutable)
-              || thread_p))
+  if (decl_context != NORMAL
+      && ((storage_class != sc_none
+          && storage_class != sc_mutable)
+         || thread_p))
     {
       if ((decl_context == PARM || decl_context == CATCHPARM)
          && (storage_class == sc_register
index 9223aa4..17252b2 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-26  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/31747
+       * g++.dg/parse/crash39.C: New.
+
 2007-10-26  Uros Bizjak  <ubizjak@gmail.com>
 
        * g++.dg/tree-ssa/ivopts-1.C: Remove xfail on the search for
diff --git a/gcc/testsuite/g++.dg/parse/crash39.C b/gcc/testsuite/g++.dg/parse/crash39.C
new file mode 100644 (file)
index 0000000..2f39c10
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/31747
+
+static extern int i; // { dg-error "conflicting specifiers" }