Commit ffe0f557 by Jason Merrill Committed by Jason Merrill

pt.c (tsubst_copy): Don't call tsubst for local variables, look them up instead.

	* pt.c (tsubst_copy) [VAR_DECL]: Don't call tsubst for
	local variables, look them up instead.
	(tsubst_decl) [VAR_DECL]: Remove handling for anonymous union
	proxies and substitution in unevaluated context.
	(tsubst_expr) [OMP_FOR]: Instantiate OMP_FOR_PRE_BODY
	before the iterators.

From-SVN: r197811
parent 0a376301
2013-04-11 Jason Merrill <jason@redhat.com> 2013-04-11 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_copy) [VAR_DECL]: Don't call tsubst for
local variables, look them up instead.
(tsubst_decl) [VAR_DECL]: Remove handling for anonymous union
proxies and substitution in unevaluated context.
(tsubst_expr) [OMP_FOR]: Instantiate OMP_FOR_PRE_BODY
before the iterators.
PR c++/23055 PR c++/23055
* pt.c (uses_deducible_template_parms): New. * pt.c (uses_deducible_template_parms): New.
(deducible_array_bound, deducible_expression): New. (deducible_array_bound, deducible_expression): New.
......
...@@ -10633,16 +10633,6 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) ...@@ -10633,16 +10633,6 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
break; break;
} }
if (VAR_P (t) && 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. */ /* Create a new node for the specialization we need. */
r = copy_decl (t); r = copy_decl (t);
if (type == NULL_TREE) if (type == NULL_TREE)
...@@ -10747,21 +10737,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) ...@@ -10747,21 +10737,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
SET_DECL_IMPLICIT_INSTANTIATION (r); SET_DECL_IMPLICIT_INSTANTIATION (r);
} }
else if (cp_unevaluated_operand) else if (cp_unevaluated_operand)
{ gcc_unreachable ();
/* We're substituting this var in a decltype outside of its
scope, such as for a lambda return type. Don't add it to
local_specializations, do perform auto deduction. */
tree auto_node = type_uses_auto (type);
if (auto_node)
{
tree init
= tsubst_expr (DECL_INITIAL (t), args, complain, in_decl,
/*constant_expression_p=*/false);
init = resolve_nondeduced_context (init);
TREE_TYPE (r) = type
= do_auto_deduction (type, init, auto_node);
}
}
else else
register_local_specialization (r, t); register_local_specialization (r, t);
...@@ -12175,11 +12151,32 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -12175,11 +12151,32 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case VAR_DECL: case VAR_DECL:
case FUNCTION_DECL: case FUNCTION_DECL:
if ((DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t)) if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t))
|| local_variable_p (t)) r = tsubst (t, args, complain, in_decl);
t = tsubst (t, args, complain, in_decl); else if (local_variable_p (t))
mark_used (t); {
return t; r = retrieve_local_specialization (t);
if (r == NULL_TREE)
{
if (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);
}
else
{
gcc_assert (errorcount || sorrycount);
return error_mark_node;
}
}
}
else
r = t;
mark_used (r);
return r;
case NAMESPACE_DECL: case NAMESPACE_DECL:
return t; return t;
...@@ -13218,15 +13215,15 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, ...@@ -13218,15 +13215,15 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
stmt = begin_omp_structured_block (); stmt = begin_omp_structured_block ();
pre_body = push_stmt_list ();
RECUR (OMP_FOR_PRE_BODY (t));
pre_body = pop_stmt_list (pre_body);
for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (t)); i++) for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (t)); i++)
tsubst_omp_for_iterator (t, i, declv, initv, condv, incrv, tsubst_omp_for_iterator (t, i, declv, initv, condv, incrv,
&clauses, args, complain, in_decl, &clauses, args, complain, in_decl,
integral_constant_expression_p); integral_constant_expression_p);
pre_body = push_stmt_list ();
RECUR (OMP_FOR_PRE_BODY (t));
pre_body = pop_stmt_list (pre_body);
body = push_stmt_list (); body = push_stmt_list ();
RECUR (OMP_FOR_BODY (t)); RECUR (OMP_FOR_BODY (t));
body = pop_stmt_list (body); body = pop_stmt_list (body);
......
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