From: Volker Reichelt Date: Mon, 12 Jun 2006 21:00:31 +0000 (+0000) Subject: re PR c++/27951 (ICE with invalid anonymous union) X-Git-Tag: releases/gcc-4.0.4~621 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92f90bae387c82ce43dcd1ae67edaa4d1eb7a031;p=thirdparty%2Fgcc.git re PR c++/27951 (ICE with invalid anonymous union) PR c++/27951 * decl2.c (finish_anon_union): Return early if build_anon_union_vars fails. * g++.dg/other/anon4.C: New test. From-SVN: r114579 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9b2715c199aa..7016c34afee9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2006-06-12 Volker Reichelt + + PR c++/27951 + * decl2.c (finish_anon_union): Return early if build_anon_union_vars + fails. + 2006-06-07 Volker Reichelt PR c++/27601 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 1d061aeca99b..f7c6675cf479 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1183,6 +1183,8 @@ finish_anon_union (tree anon_union_decl) } main_decl = build_anon_union_vars (type, anon_union_decl); + if (main_decl == error_mark_node) + return; if (main_decl == NULL_TREE) { warning ("anonymous union with no members"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55f39720f424..01844c771ec5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-06-12 Volker Reichelt + + PR c++/27951 + * g++.dg/other/anon4.C: New test. + 2006-06-07 Volker Reichelt PR c++/27601 diff --git a/gcc/testsuite/g++.dg/other/anon4.C b/gcc/testsuite/g++.dg/other/anon4.C new file mode 100644 index 000000000000..571f4ae65fb6 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/anon4.C @@ -0,0 +1,8 @@ +// PR c++/27951 +// { dg-do compile } + +void foo() +{ + int i; // { dg-error "previously" } + union { int i; }; // { dg-error "redeclaration" } +}