------- 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