re PR c++/54511 (internal compiler error: in make_decl_rtl, at varasm.c:1147)

PR c++/54511
	* pt.c (tsubst_decl) [VAR_DECL]: Handle DECL_ANON_UNION_VAR_P.

From-SVN: r191265
This commit is contained in:
Jason Merrill 2012-09-13 11:14:49 -04:00 committed by Jason Merrill
parent a3f1a5b9d3
commit 1a4d4885c6
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2012-09-13 Jason Merrill <jason@redhat.com>
PR c++/54511
* pt.c (tsubst_decl) [VAR_DECL]: Handle DECL_ANON_UNION_VAR_P.
2012-09-13 Jason Merrill <jason@redhat.com>
PR c++/53836

View File

@ -10706,6 +10706,16 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
break;
}
if (TREE_CODE (t) == VAR_DECL && DECL_ANON_UNION_VAR_P (t))
{
/* Just use name lookup to find a member alias for an anonymous
union, but then add it to the hash table. */
r = lookup_name (DECL_NAME (t));
gcc_assert (DECL_ANON_UNION_VAR_P (r));
register_local_specialization (r, t);
break;
}
/* Create a new node for the specialization we need. */
r = copy_decl (t);
if (type == NULL_TREE)

View File

@ -1,3 +1,8 @@
2012-09-13 Jason Merrill <jason@redhat.com>
PR c++/54511
* g++.dg/template/anonunion2.C: New.
2012-09-13 Jason Merrill <jason@redhat.com>
PR c++/53836

View File

@ -0,0 +1,6 @@
template <int i>
struct S
{
S () { union { int a; }; a = 0; }
};
S<0> s;