http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49609
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-01 16:34:32 UTC --- (In reply to comment #1) > The C++ standard lists the contexts in which an overloaded function name can > be > used without arguments, and reinterpret_cast is not one of them. > > Based on that, I would think G++ 4.4 was correct to reject the code. I note > that clang++ gives the same behaviour as G++ 4.7 (accepts the code but does > not > instantiate the function template) Ah, I think this behaviour is covered by the new text added to 13.4 p2 by http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#115 That paragraph says that if template argument deduction succeeds then an instantiation is generated. In your case deduction doesn't succeed because the target type is not available. The note added by DR 115 says that the specialization can be identified if there's a template argument list, which is what happens in your example, but it doesn't say that the function template is instantiated in that case. > You can make it work by using an explicit type conversion to the correct type > before doing the reinterpret_cast: > > void *(*my_function_ptr)(void*, void *) > = reinterpret_cast<void*(*)(void*,void*)>( > (void*(*)(float*,float*))&(value_convert_function<float, float>) ); You can also make it work by not specifying an explicit template argument list and letting them be deduced: void *(*my_function_ptr)(void*, void *) = reinterpret_cast<void*(*)(void*,void*)>( (void*(*)(float*,float*))&value_convert_function); As 13.4 p2 says, that causes the template to be instantiated.