aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-08-24 14:58:00 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-08-24 14:58:00 -0400
commit92849267248d0be496bfa682e72d93776e6a3d7c (patch)
tree04c0f3b95e5eb900944fab73faf832319f7e2d54
parent60b5de49ef8049c7d6d48130cb501cc97794b6ad (diff)
downloadgcc-92849267248d0be496bfa682e72d93776e6a3d7c.zip
gcc-92849267248d0be496bfa682e72d93776e6a3d7c.tar.gz
gcc-92849267248d0be496bfa682e72d93776e6a3d7c.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c56
2 files changed, 21 insertions, 39 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9eb4b87..be3a95a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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
check_specialization_namespace.
(determine_specialization): Don't consider members of
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 580a3d4..eff0b4d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -15246,10 +15246,12 @@ resolve_overloaded_unification (tree tparms,
if (TREE_CODE (fn) != TEMPLATE_DECL)
continue;
- ++processing_template_decl;
- subargs = get_bindings (fn, DECL_TEMPLATE_RESULT (fn),
- expl_subargs, /*check_ret=*/false);
- if (subargs && !any_dependent_template_arguments_p (subargs))
+ subargs = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn),
+ expl_subargs, NULL_TREE, tf_none,
+ /*require_all_args=*/true,
+ /*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);
if (try_one_overload (tparms, targs, tempargs, parm,
@@ -15262,7 +15264,6 @@ resolve_overloaded_unification (tree tparms,
}
else if (subargs)
++ok;
- --processing_template_decl;
}
/* If no templates (or more than one) are fully resolved by the
explicit arguments, this template-id is a non-deduced context; it
@@ -15367,10 +15368,12 @@ resolve_nondeduced_context (tree orig_expr)
if (TREE_CODE (fn) != TEMPLATE_DECL)
continue;
- ++processing_template_decl;
- subargs = get_bindings (fn, DECL_TEMPLATE_RESULT (fn),
- expl_subargs, /*check_ret=*/false);
- if (subargs && !any_dependent_template_arguments_p (subargs))
+ subargs = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn),
+ expl_subargs, NULL_TREE, tf_none,
+ /*require_all_args=*/true,
+ /*use_default_args=*/true);
+ if (subargs != error_mark_node
+ && !any_dependent_template_arguments_p (subargs))
{
elem = instantiate_template (fn, subargs, tf_none);
if (elem == error_mark_node)
@@ -15384,7 +15387,6 @@ resolve_nondeduced_context (tree orig_expr)
++good;
}
}
- --processing_template_decl;
}
if (good == 1)
{
@@ -15435,6 +15437,9 @@ try_one_overload (tree tparms,
tree tempargs;
int i;
+ if (arg == error_mark_node)
+ return 0;
+
/* [temp.deduct.type] A template-argument can be deduced from a pointer
to function or pointer to member function argument if the set of
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)
{
int ntparms = DECL_NTPARMS (fn);
tree targs = make_tree_vec (ntparms);
- tree decl_type;
+ tree decl_type = TREE_TYPE (decl);
tree decl_arg_types;
tree *args;
unsigned int nargs, ix;
tree arg;
- /* Substitute the explicit template arguments into the type of DECL.
- 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;
- }
+ gcc_assert (decl != DECL_TEMPLATE_RESULT (fn));
/* Never do unification on the 'this' parameter. */
decl_arg_types = skip_artificial_parms_for (decl,