for (cand = candidates; cand != old_candidates; cand = cand->next)
{
- conversion *ics
- = implicit_conversion (totype,
- TREE_TYPE (TREE_TYPE (cand->fn)),
- 0,
- /*c_cast_p=*/false, convflags);
+ tree fn = OVL_CURRENT (fns);
+
+ if (DECL_NONCONVERTING_P (fn)
+ && (flags & LOOKUP_ONLYCONVERTING))
+ continue;
+
+ /* [over.match.funcs] For conversion functions, the function
+ is considered to be a member of the class of the implicit
+ object argument for the purpose of defining the type of
+ the implicit object parameter.
+
+ So we pass fromtype as CTYPE to add_*_candidate. */
+
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ cand = add_template_candidate (&candidates, fn, fromtype,
+ NULL_TREE,
+ first_arg, NULL, totype,
+ TYPE_BINFO (fromtype),
+ conversion_path,
+ flags,
+ DEDUCE_CONV);
+ else
+ cand = add_function_candidate (&candidates, fn, fromtype,
+ first_arg, NULL,
+ TYPE_BINFO (fromtype),
+ conversion_path,
+ flags);
/* If LOOKUP_NO_TEMP_BIND isn't set, then this is
copy-initialization. In that case, "The result of the
{
first_mem_arg = build_this (obj);
- add_candidates (BASELINK_FUNCTIONS (fns),
- first_mem_arg, *args, NULL_TREE,
- NULL_TREE, false,
- BASELINK_BINFO (fns), BASELINK_ACCESS_BINFO (fns),
- LOOKUP_NORMAL, &candidates);
+ for (fns = BASELINK_FUNCTIONS (fns); fns; fns = OVL_NEXT (fns))
+ {
+ tree fn = OVL_CURRENT (fns);
+
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ add_template_candidate (&candidates, fn, base, NULL_TREE,
+ first_mem_arg, *args, NULL_TREE,
+ TYPE_BINFO (type),
+ TYPE_BINFO (type),
+ LOOKUP_NORMAL, DEDUCE_CALL);
+ else
+ add_function_candidate
+ (&candidates, fn, base, first_mem_arg, *args, TYPE_BINFO (type),
+ TYPE_BINFO (type), LOOKUP_NORMAL);
+ }
}
convs = lookup_conversions (type, /*lookup_template_convs_p=*/true);