static void push_access_scope (tree);
static void pop_access_scope (tree);
-static int resolve_overloaded_unification (tree, tree, tree, tree,
- unification_kind_t, int);
+static bool resolve_overloaded_unification (tree, tree, tree, tree,
+ unification_kind_t, int);
static int try_one_overload (tree, tree, tree, tree, tree,
unification_kind_t, int, bool);
static int unify (tree, tree, tree, tree, int);
gcc_assert (TREE_TYPE (arg) != NULL_TREE);
if (type_unknown_p (arg))
{
- /* [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 one of a set of
- overloaded functions provides a unique match. */
+ /* [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 one of a set of
+ overloaded functions provides a unique match. */
if (resolve_overloaded_unification
- (tparms, targs, parm, arg, strict, sub_strict)
- != 0)
- return 1;
- continue;
+ (tparms, targs, parm, arg, strict, sub_strict))
+ continue;
+
+ return 1;
}
arg_expr = arg;
arg = unlowered_expr_type (arg);
return 0;
}
-/* Subroutine of type_unification_real. Args are like the variables at the
- call site. ARG is an overloaded function (or template-id); we try
- deducing template args from each of the overloads, and if only one
- succeeds, we go with that. Modifies TARGS and returns 0 on success. */
+/* Subroutine of type_unification_real. Args are like the variables
+ at the call site. ARG is an overloaded function (or template-id);
+ we try deducing template args from each of the overloads, and if
+ only one succeeds, we go with that. Modifies TARGS and returns
+ true on success. */
-static int
+static bool
resolve_overloaded_unification (tree tparms,
tree targs,
tree parm,
}
}
}
+ else if (TREE_CODE (arg) != OVERLOAD
+ && TREE_CODE (arg) != FUNCTION_DECL)
+ /* If ARG is, for example, "(0, &f)" then its type will be unknown
+ -- but the deduction does not succeed because the expression is
+ not just the function on its own. */
+ return false;
else
- {
- gcc_assert (TREE_CODE (arg) == OVERLOAD
- || TREE_CODE (arg) == FUNCTION_DECL);
-
- for (; arg; arg = OVL_NEXT (arg))
- good += try_one_overload (tparms, targs, tempargs, parm,
- TREE_TYPE (OVL_CURRENT (arg)),
- strict, sub_strict, addr_p);
- }
+ for (; arg; arg = OVL_NEXT (arg))
+ good += try_one_overload (tparms, targs, tempargs, parm,
+ TREE_TYPE (OVL_CURRENT (arg)),
+ strict, sub_strict, addr_p);
/* [temp.deduct.type] A template-argument can be deduced from a pointer
to function or pointer to member function argument if the set of
TREE_VEC_ELT (targs, i) = TREE_VEC_ELT (tempargs, i);
}
if (good)
- return 0;
+ return true;
- return 1;
+ return false;
}
/* Subroutine of resolve_overloaded_unification; does deduction for a single