http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40127
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-15
20:01:35 UTC ---
This code is invalid (and other compilers agree with me). What type is going
to be chosen for T? void*, int*, any pointer type? There is no way the
compiler can deduce the type of T from the arguments.
This code is valid though:
template<typename T>
void foo(int i, void(*f)(T*) = 0, T* a = 0) {}
int main() {
foo<void>(5);
return 0;
}
AS the compiler does not need to deduce the template argument type.