From 9b70c6b0780bc6fef0278d6af9f551bc3f21eaa3 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 26 Oct 2007 09:57:12 +0000 Subject: re PR c++/31747 (ICE combining static and extern) cp/ 2007-10-26 Paolo Carlini PR c++/31747 * decl.c (grokdeclarator): In case of conflicting specifiers just return error_mark_node. testsuite/ 2007-10-26 Paolo Carlini PR c++/31747 * g++.dg/parse/crash39.C: New. From-SVN: r129647 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 19 ++++++++++--------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/crash39.C | 3 +++ 4 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/parse/crash39.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b4edd88..e345e75 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-10-26 Paolo Carlini + + PR c++/31747 + * decl.c (grokdeclarator): In case of conflicting specifiers + just return error_mark_node. + 2007-10-26 Ollie Wild * expr.c (cxx_expand_expr): Removed. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 136c8df..9bab97b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9223aa4..17252b2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-10-26 Paolo Carlini + + PR c++/31747 + * g++.dg/parse/crash39.C: New. + 2007-10-26 Uros Bizjak * 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 index 0000000..2f39c10 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash39.C @@ -0,0 +1,3 @@ +// PR c++/31747 + +static extern int i; // { dg-error "conflicting specifiers" } -- cgit v1.1