This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/40793] "Error: no matching function for call to XYZ" doesn't display function-template-arguments
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Jul 2010 21:31:06 -0000
- Subject: [Bug c++/40793] "Error: no matching function for call to XYZ" doesn't display function-template-arguments
- References: <bug-40793-17961@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from manu at gcc dot gnu dot org 2010-07-01 21:31 -------
With the patch below, we print this:
pr40793.C:5:31: error: no matching function for call to ?staticPrint<double,
"text">()?
pr40793.C:2:18: note: candidate is: template<class T, T t> void staticPrint()
but I am not sure if it is possible to print the type of "text". Any ideas?
Index: call.c
===================================================================
--- call.c (revision 161658)
+++ call.c (working copy)
@@ -3247,12 +3247,19 @@ build_new_function_call (tree fn, VEC(tr
{
if (!any_viable_p && candidates && ! candidates->next
&& (TREE_CODE (candidates->fn) == FUNCTION_DECL))
return cp_build_function_call_vec (candidates->fn, args, complain);
if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
- fn = TREE_OPERAND (fn, 0);
- if (!any_viable_p)
+ {
+ if (!any_viable_p)
+ error ("no matching function for call to %<%E(%A)%>",
+ fn, build_tree_list_vec (*args));
+ else
+ error ("call of overloaded %<%E(%A)%> is ambiguous",
+ fn, build_tree_list_vec (*args));
+ }
+ else if (!any_viable_p)
error ("no matching function for call to %<%D(%A)%>",
DECL_NAME (OVL_CURRENT (fn)), build_tree_list_vec (*args));
else
error ("call of overloaded %<%D(%A)%> is ambiguous",
DECL_NAME (OVL_CURRENT (fn)), build_tree_list_vec (*args));
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40793