[Bug c++/40127] Fails to identify template function with default args
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jan 15 23:26:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40127
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-15 23:16:53 UTC ---
(In reply to comment #0)
> I'm not sure whether argument types can be bound from default arguments in the
> standard,
They can't.
> but if they can't then I should get a diagnostic at the declaration
> of the template.
As Andrew showed, the template isn't invalid and can be called with an explicit
template argument list, so issuing a diagnostic at declaration would be wrong.
> The actual message is cryptic and unhelpful.
Current versions give a great diagnostic:
c.cc: In function ‘int main()’:
c.cc:4:14: error: no matching function for call to ‘foo(int)’
c.cc:4:14: note: candidate is:
c.cc:2:9: note: template<class T> void foo(int, void (*)(T*), T*)
c.cc:2:9: note: template argument deduction/substitution failed:
c.cc:4:14: note: couldn't deduce template parameter ‘T’
More information about the Gcc-bugs
mailing list