OSDN Git Service

PR c++/16971
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Aug 2004 00:14:37 +0000 (00:14 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Aug 2004 00:14:37 +0000 (00:14 +0000)
* parser.c (cp_parser_init_declarator): Robustify.

PR c++/16971
* g++.dg/parse/crash16.C: New test.

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

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

index be759c5..269b20b 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/16971
+       * parser.c (cp_parser_init_declarator): Robustify.
+
 2004-08-06  Richard Sandiford  <rsandifo@redhat.com>
 
        * typeck2.c (process_init_constructor): Guard the missing field warning
index d6aadb3..2176e05 100644 (file)
@@ -10702,7 +10702,7 @@ cp_parser_init_declarator (cp_parser* parser,
 
   /* Finish processing the declaration.  But, skip friend
      declarations.  */
-  if (!friend_p && decl)
+  if (!friend_p && decl && decl != error_mark_node)
     {
       cp_finish_decl (decl,
                      initializer,
index 2dda1e5..022280c 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/16971
+       * g++.dg/parse/crash16.C: New test.
+
 2004-08-10  Roger Sayle  <roger@eyesopen.com>
 
        * gcc.dg/mips-rsqrt-1.c: New test case.
diff --git a/gcc/testsuite/g++.dg/parse/crash16.C b/gcc/testsuite/g++.dg/parse/crash16.C
new file mode 100644 (file)
index 0000000..dc8f7a6
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/16971
+
+namespace N {
+  int i; // { dg-error "" }
+  // By checking for an explicit keyword on the next line we avoid
+  // matching an ICE message.
+  int i; // { dg-error "redefinition" }
+}