re PR c++/58701 ([c++11] ICE initializing member of static union)

PR c++/58701
	* semantics.c (build_anon_member_initialization): Stop walking
	when we run out of COMPONENT_REFs.

From-SVN: r207209
This commit is contained in:
Jason Merrill 2014-01-28 16:04:44 -05:00 committed by Jason Merrill
parent 3807059e82
commit 0f59a31da8
3 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2014-01-28 Jason Merrill <jason@redhat.com>
PR c++/58701
* semantics.c (build_anon_member_initialization): Stop walking
when we run out of COMPONENT_REFs.
PR c++/58632
* decl.c (lookup_and_check_tag): Ignore template parameters if
scope == ts_current.

View File

@ -7515,7 +7515,8 @@ build_anon_member_initialization (tree member, tree init,
fields.safe_push (TREE_OPERAND (member, 1));
member = TREE_OPERAND (member, 0);
}
while (ANON_AGGR_TYPE_P (TREE_TYPE (member)));
while (ANON_AGGR_TYPE_P (TREE_TYPE (member))
&& TREE_CODE (member) == COMPONENT_REF);
/* VEC has the constructor elements vector for the context of FIELD.
If FIELD is an anonymous aggregate, we will push inside it. */

View File

@ -0,0 +1,11 @@
// PR c++/58701
// { dg-require-effective-target c++11 }
// { dg-final { scan-assembler "7" } }
static union
{
union
{
int i = 7;
};
};