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: r114577
This commit is contained in:
Volker Reichelt 2006-06-12 20:50:53 +00:00 committed by Volker Reichelt
parent 02a5eac483
commit 8bdb09cb0b
4 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2006-06-12 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27951
* decl2.c (finish_anon_union): Return early if build_anon_union_vars
fails.
2006-06-12 Roger Sayle <roger@eyesopen.com>
PR c++/21210

View File

@ -1109,6 +1109,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 (0, "anonymous union with no members");

View File

@ -1,3 +1,8 @@
2006-06-12 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27951
* g++.dg/other/anon4.C: New test.
2006-06-12 Roger Sayle <roger@eyesopen.com>
PR c++/21210

View File

@ -0,0 +1,8 @@
// PR c++/27951
// { dg-do compile }
void foo()
{
int i; // { dg-error "previously" }
union { int i; }; // { dg-error "redeclaration" }
}