]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/16971 (ICE on duplicate definition)
authorMark Mitchell <mark@codesourcery.com>
Wed, 11 Aug 2004 00:14:37 +0000 (00:14 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 11 Aug 2004 00:14:37 +0000 (00:14 +0000)
PR c++/16971
* parser.c (cp_parser_init_declarator): Robustify.

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

From-SVN: r85776

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

index be759c5840db0eea0d0526d5ad76de4338bcd73c..269b20bd15e06161415d4116d1a9417e2a5fa035 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 d6aadb37cd783afcb8a15ab51e383c88bfa4ef38..2176e05eecefeb02703afbcd0798c70fd6731cb5 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 2dda1e5af0a2c4ce35799c344fec6ebb333498ea..022280c2ea92f8ce3730ebd5b800fa34aab23831 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" }
+}
This page took 0.102517 seconds and 5 git commands to generate.