Commit c29f393f by Jason Merrill Committed by Jason Merrill

call.c (print_error_for_call_failure): Say "no match" rather than "ambiguous" if…

call.c (print_error_for_call_failure): Say "no match" rather than "ambiguous" if there were no strict matches.

	* call.c (print_error_for_call_failure): Say "no match" rather
	than "ambiguous" if there were no strict matches.
	(build_new_method_call_1): Likewise.

From-SVN: r210402
parent bd5c3baa
2014-05-13 Jason Merrill <jason@redhat.com>
* call.c (print_error_for_call_failure): Say "no match" rather
than "ambiguous" if there were no strict matches.
(build_new_method_call_1): Likewise.
PR c++/61151
* semantics.c (is_this_parameter): Allow capture proxies too.
......
......@@ -3914,13 +3914,13 @@ perform_overload_resolution (tree fn,
functions. */
static void
print_error_for_call_failure (tree fn, vec<tree, va_gc> *args, bool any_viable_p,
print_error_for_call_failure (tree fn, vec<tree, va_gc> *args,
struct z_candidate *candidates)
{
tree name = DECL_NAME (OVL_CURRENT (fn));
location_t loc = location_of (name);
if (!any_viable_p)
if (!any_strictly_viable (candidates))
error_at (loc, "no matching function for call to %<%D(%A)%>",
name, build_tree_list_vec (args));
else
......@@ -3964,7 +3964,7 @@ build_new_function_call (tree fn, vec<tree, va_gc> **args, bool koenig_p,
if (!fn)
{
if (complain & tf_error)
print_error_for_call_failure (orig_fn, *args, false, NULL);
print_error_for_call_failure (orig_fn, *args, NULL);
return error_mark_node;
}
}
......@@ -3984,7 +3984,7 @@ build_new_function_call (tree fn, vec<tree, va_gc> **args, bool koenig_p,
return cp_build_function_call_vec (candidates->fn, args, complain);
if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
fn = TREE_OPERAND (fn, 0);
print_error_for_call_failure (fn, *args, any_viable_p, candidates);
print_error_for_call_failure (fn, *args, candidates);
}
result = error_mark_node;
}
......@@ -4066,7 +4066,7 @@ build_operator_new_call (tree fnname, vec<tree, va_gc> **args,
if (!cand)
{
if (complain & tf_error)
print_error_for_call_failure (fns, *args, any_viable_p, candidates);
print_error_for_call_failure (fns, *args, candidates);
return error_mark_node;
}
......@@ -7898,8 +7898,12 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
arglist = build_tree_list_vec (user_args);
if (skip_first_for_error)
arglist = TREE_CHAIN (arglist);
error ("call of overloaded %<%s(%A)%> is ambiguous", pretty_name,
arglist);
if (!any_strictly_viable (candidates))
error ("no matching function for call to %<%s(%A)%>",
pretty_name, arglist);
else
error ("call of overloaded %<%s(%A)%> is ambiguous",
pretty_name, arglist);
print_z_candidates (location_of (name), candidates);
if (free_p)
free (pretty_name);
......
......@@ -492,7 +492,7 @@ int test2_67()
const A ca = a; // { dg-error "deleted" }
volatile A va;
const volatile A cva = a; // { dg-error "deleted" }
sink_2_67(a); // { dg-error "ambiguous" }
sink_2_67(a); // { dg-error "no match" }
// { dg-message "candidate" "candidate note" { target *-*-* } 495 }
sink_2_67(ca); // { dg-error "lvalue" }
sink_2_67(va); // { dg-error "lvalue" }
......
......@@ -930,7 +930,7 @@ int test3_678()
const A ca = a; // { dg-error "deleted" }
volatile A va;
const volatile A cva = a; // { dg-error "deleted" }
sink_3_678(a); // { dg-error "ambiguous" }
sink_3_678(a); // { dg-error "no match" }
// { dg-message "candidate" "candidate note" { target *-*-* } 933 }
sink_3_678(ca); // { dg-error "lvalue" }
sink_3_678(va); // { dg-error "lvalue" }
......
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