diff options
author | Jason Merrill <jason@redhat.com> | 2014-05-13 17:10:03 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-05-13 17:10:03 -0400 |
commit | c29f393f8326d3e4ec0a7841e8f3c45137f62795 (patch) | |
tree | d616f4cbd879ba88abedb9a0ac923c1b479c2946 /gcc | |
parent | bd5c3baaa9066243a3eb2e584534277878657b20 (diff) | |
download | gcc-c29f393f8326d3e4ec0a7841e8f3c45137f62795.zip gcc-c29f393f8326d3e4ec0a7841e8f3c45137f62795.tar.gz gcc-c29f393f8326d3e4ec0a7841e8f3c45137f62795.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/call.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/rv2n.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/rv3n.C | 2 |
4 files changed, 17 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a26472c..70a167f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 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. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 7b8bc09..d8a7dcd 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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); diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2n.C b/gcc/testsuite/g++.dg/cpp0x/rv2n.C index 289cffb..5444c78 100644 --- a/gcc/testsuite/g++.dg/cpp0x/rv2n.C +++ b/gcc/testsuite/g++.dg/cpp0x/rv2n.C @@ -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" } diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3n.C b/gcc/testsuite/g++.dg/cpp0x/rv3n.C index 765dfbc..3a729cb 100644 --- a/gcc/testsuite/g++.dg/cpp0x/rv3n.C +++ b/gcc/testsuite/g++.dg/cpp0x/rv3n.C @@ -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" } |