Commit 92849267 by Jason Merrill Committed by Jason Merrill

pt.c (resolve_overloaded_unification): Use coerce_template_parms instead of get_bindings.

	* pt.c (resolve_overloaded_unification): Use coerce_template_parms
	instead of get_bindings.
	(resolve_nondeduced_context): Likewise.

From-SVN: r190653
parent 60b5de49
2012-08-24 Jason Merrill <jason@redhat.com> 2012-08-24 Jason Merrill <jason@redhat.com>
* pt.c (resolve_overloaded_unification): Use coerce_template_parms
instead of get_bindings.
(resolve_nondeduced_context): Likewise.
* pt.c (register_specialization): Correct argument to * pt.c (register_specialization): Correct argument to
check_specialization_namespace. check_specialization_namespace.
(determine_specialization): Don't consider members of (determine_specialization): Don't consider members of
......
...@@ -15246,10 +15246,12 @@ resolve_overloaded_unification (tree tparms, ...@@ -15246,10 +15246,12 @@ resolve_overloaded_unification (tree tparms,
if (TREE_CODE (fn) != TEMPLATE_DECL) if (TREE_CODE (fn) != TEMPLATE_DECL)
continue; continue;
++processing_template_decl; subargs = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn),
subargs = get_bindings (fn, DECL_TEMPLATE_RESULT (fn), expl_subargs, NULL_TREE, tf_none,
expl_subargs, /*check_ret=*/false); /*require_all_args=*/true,
if (subargs && !any_dependent_template_arguments_p (subargs)) /*use_default_args=*/true);
if (subargs != error_mark_node
&& !any_dependent_template_arguments_p (subargs))
{ {
elem = tsubst (TREE_TYPE (fn), subargs, tf_none, NULL_TREE); elem = tsubst (TREE_TYPE (fn), subargs, tf_none, NULL_TREE);
if (try_one_overload (tparms, targs, tempargs, parm, if (try_one_overload (tparms, targs, tempargs, parm,
...@@ -15262,7 +15264,6 @@ resolve_overloaded_unification (tree tparms, ...@@ -15262,7 +15264,6 @@ resolve_overloaded_unification (tree tparms,
} }
else if (subargs) else if (subargs)
++ok; ++ok;
--processing_template_decl;
} }
/* If no templates (or more than one) are fully resolved by the /* If no templates (or more than one) are fully resolved by the
explicit arguments, this template-id is a non-deduced context; it explicit arguments, this template-id is a non-deduced context; it
...@@ -15367,10 +15368,12 @@ resolve_nondeduced_context (tree orig_expr) ...@@ -15367,10 +15368,12 @@ resolve_nondeduced_context (tree orig_expr)
if (TREE_CODE (fn) != TEMPLATE_DECL) if (TREE_CODE (fn) != TEMPLATE_DECL)
continue; continue;
++processing_template_decl; subargs = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn),
subargs = get_bindings (fn, DECL_TEMPLATE_RESULT (fn), expl_subargs, NULL_TREE, tf_none,
expl_subargs, /*check_ret=*/false); /*require_all_args=*/true,
if (subargs && !any_dependent_template_arguments_p (subargs)) /*use_default_args=*/true);
if (subargs != error_mark_node
&& !any_dependent_template_arguments_p (subargs))
{ {
elem = instantiate_template (fn, subargs, tf_none); elem = instantiate_template (fn, subargs, tf_none);
if (elem == error_mark_node) if (elem == error_mark_node)
...@@ -15384,7 +15387,6 @@ resolve_nondeduced_context (tree orig_expr) ...@@ -15384,7 +15387,6 @@ resolve_nondeduced_context (tree orig_expr)
++good; ++good;
} }
} }
--processing_template_decl;
} }
if (good == 1) if (good == 1)
{ {
...@@ -15435,6 +15437,9 @@ try_one_overload (tree tparms, ...@@ -15435,6 +15437,9 @@ try_one_overload (tree tparms,
tree tempargs; tree tempargs;
int i; int i;
if (arg == error_mark_node)
return 0;
/* [temp.deduct.type] A template-argument can be deduced from a pointer /* [temp.deduct.type] A template-argument can be deduced from a pointer
to function or pointer to member function argument if the set of to function or pointer to member function argument if the set of
overloaded functions does not contain function templates and at most overloaded functions does not contain function templates and at most
...@@ -17129,40 +17134,13 @@ get_bindings (tree fn, tree decl, tree explicit_args, bool check_rettype) ...@@ -17129,40 +17134,13 @@ get_bindings (tree fn, tree decl, tree explicit_args, bool check_rettype)
{ {
int ntparms = DECL_NTPARMS (fn); int ntparms = DECL_NTPARMS (fn);
tree targs = make_tree_vec (ntparms); tree targs = make_tree_vec (ntparms);
tree decl_type; tree decl_type = TREE_TYPE (decl);
tree decl_arg_types; tree decl_arg_types;
tree *args; tree *args;
unsigned int nargs, ix; unsigned int nargs, ix;
tree arg; tree arg;
/* Substitute the explicit template arguments into the type of DECL. gcc_assert (decl != DECL_TEMPLATE_RESULT (fn));
The call to fn_type_unification will handle substitution into the
FN. */
decl_type = TREE_TYPE (decl);
if (explicit_args && decl == DECL_TEMPLATE_RESULT (fn))
{
tree tmpl;
tree converted_args;
if (DECL_TEMPLATE_INFO (decl))
tmpl = DECL_TI_TEMPLATE (decl);
else
/* We can get here for some invalid specializations. */
return NULL_TREE;
converted_args
= coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (tmpl),
explicit_args, NULL_TREE,
tf_none,
/*require_all_args=*/false,
/*use_default_args=*/false);
if (converted_args == error_mark_node)
return NULL_TREE;
decl_type = tsubst (decl_type, converted_args, tf_none, NULL_TREE);
if (decl_type == error_mark_node)
return NULL_TREE;
}
/* Never do unification on the 'this' parameter. */ /* Never do unification on the 'this' parameter. */
decl_arg_types = skip_artificial_parms_for (decl, decl_arg_types = skip_artificial_parms_for (decl,
......
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