From: Mark Mitchell Date: Wed, 11 Aug 2004 00:14:37 +0000 (+0000) Subject: re PR c++/16971 (ICE on duplicate definition) X-Git-Tag: releases/gcc-4.0.0~6001 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=550205c3aefe911b63cdd13defd687a630dbc225;p=thirdparty%2Fgcc.git re PR c++/16971 (ICE on duplicate definition) PR c++/16971 * parser.c (cp_parser_init_declarator): Robustify. PR c++/16971 * g++.dg/parse/crash16.C: New test. From-SVN: r85776 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index be759c5840db..269b20bd15e0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-08-10 Mark Mitchell + + PR c++/16971 + * parser.c (cp_parser_init_declarator): Robustify. + 2004-08-06 Richard Sandiford * typeck2.c (process_init_constructor): Guard the missing field warning diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d6aadb37cd78..2176e05eecef 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2dda1e5af0a2..022280c2ea92 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-08-10 Mark Mitchell + + PR c++/16971 + * g++.dg/parse/crash16.C: New test. + 2004-08-10 Roger Sayle * 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 index 000000000000..dc8f7a608d22 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash16.C @@ -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" } +}