2010-06-15 Jason Merrill <jason@redhat.com>
+ * call.c (convert_like_real): Give "initializing argument of"
+ information for ambiguous conversion. Give source position
+ of function.
+
* call.c (print_z_candidates): Do print viable deleted candidates.
(joust): Don't choose a deleted function just because its worst
conversion is better than another candidate's worst.
{
permerror (input_location, "invalid conversion from %qT to %qT", TREE_TYPE (expr), totype);
if (fn)
- permerror (input_location, " initializing argument %P of %qD", argnum, fn);
+ permerror (DECL_SOURCE_LOCATION (fn),
+ " initializing argument %P of %qD", argnum, fn);
}
else
return error_mark_node;
}
return expr;
case ck_ambig:
- if (!(complain & tf_error))
- return error_mark_node;
- /* Call build_user_type_conversion again for the error. */
- return build_user_type_conversion
- (totype, convs->u.expr, LOOKUP_NORMAL);
+ if (complain & tf_error)
+ {
+ /* Call build_user_type_conversion again for the error. */
+ build_user_type_conversion (totype, convs->u.expr, LOOKUP_NORMAL);
+ if (fn)
+ error (" initializing argument %P of %q+D", argnum, fn);
+ }
+ return error_mark_node;
case ck_list:
{
if (diag_kind && fn)
{
if ((complain & tf_error))
- emit_diagnostic (diag_kind, input_location, 0,
+ emit_diagnostic (diag_kind, DECL_SOURCE_LOCATION (fn), 0,
" initializing argument %P of %qD", argnum, fn);
else if (diag_kind == DK_ERROR)
return error_mark_node;
}
// { dg-error "invalid conversion " "" { target *-*-* } 314 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 314 }
// { dg-error "invalid conversion " "" { target *-*-* } 308 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 308 }
// { dg-error "invalid conversion " "" { target *-*-* } 331 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 331 }
// { dg-error "invalid conversion " "" { target *-*-* } 339 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 339 }
// { dg-excess-errors "In constructor" }
-