diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index be759c5840db0eea0d0526d5ad76de4338bcd73c..269b20bd15e06161415d4116d1a9417e2a5fa035 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d6aadb37cd783afcb8a15ab51e383c88bfa4ef38..2176e05eecefeb02703afbcd0798c70fd6731cb5 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 2dda1e5af0a2c4ce35799c344fec6ebb333498ea..022280c2ea92f8ce3730ebd5b800fa34aab23831 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000000000000000000000000000000000000..dc8f7a608d221e33a2a261dac1f24f40c9f21024 --- /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" } +}