Commit 093e62d2 by Jason Merrill Committed by Jason Merrill

re PR c++/60992 (ICE in tsubst_copy, at cp/pt.c:12637)

	PR c++/60992
	* pt.c (tsubst_copy) [VAR_DECL]: Try lookup first.  Add a new
	variable to local_specializations.

From-SVN: r211188
parent 918621d3
2014-06-03 Jason Merrill <jason@redhat.com> 2014-06-03 Jason Merrill <jason@redhat.com>
PR c++/60992
* pt.c (tsubst_copy) [VAR_DECL]: Try lookup first. Add a new
variable to local_specializations.
PR c++/60848 PR c++/60848
* call.c (is_std_init_list): Check CLASSTYPE_TEMPLATE_INFO. * call.c (is_std_init_list): Check CLASSTYPE_TEMPLATE_INFO.
......
...@@ -12730,14 +12730,19 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -12730,14 +12730,19 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
r = retrieve_local_specialization (t); r = retrieve_local_specialization (t);
if (r == NULL_TREE) if (r == NULL_TREE)
{ {
if (DECL_ANON_UNION_VAR_P (t)) /* First try name lookup to find the instantiation. */
r = lookup_name (DECL_NAME (t));
if (r)
{ {
/* Just use name lookup to find a member alias for an /* Make sure that the one we found is the one we want. */
anonymous union, but then add it to the hash table. */ tree ctx = tsubst (DECL_CONTEXT (t), args,
r = lookup_name (DECL_NAME (t)); complain, in_decl);
gcc_assert (DECL_ANON_UNION_VAR_P (r)); if (ctx != DECL_CONTEXT (r))
register_local_specialization (r, t); r = NULL_TREE;
} }
if (r)
/* OK */;
else else
{ {
/* This can happen for a variable used in a /* This can happen for a variable used in a
...@@ -12771,10 +12776,12 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -12771,10 +12776,12 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
else if (decl_constant_var_p (r)) else if (decl_constant_var_p (r))
/* A use of a local constant decays to its value. /* A use of a local constant decays to its value.
FIXME update for core DR 696. */ FIXME update for core DR 696. */
return integral_constant_value (r); r = integral_constant_value (r);
} }
return r;
} }
/* Remember this for subsequent uses. */
if (local_specializations)
register_local_specialization (r, t);
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment