Please consider the following code:
int f(int i){return i*i;};
int main() {
void* p = static_cast<void*>(&f);
return 0;
}
As you can see here the code does not compile.
Why is static_cast from int (*)(int) to void* not allowed in C++?