I am trying to take a pointer to an instance of function template and cast it to void*:
#include
void plainFunction(int *param) {}
template
Compiler should generate error in both cases. Function pointers are not convertible to void
* according to the Standard §4.10/2 since functions are not objects (§1.8/1). Visual Studio 2008 allows this as an extension, check this bug.
Use typedef
to avoid misunderstanding:
typedef void(func)(int*); // declare func type
func* addr1 = &plainFunction; // OK
func* addr2 = &templateFunction; // OK