fork download
  1. struct foo {
  2. int f();
  3. };
  4.  
  5. int main() {
  6. void* p = static_cast<void*>(&foo::f);
  7. }
  8.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:6: error: invalid static_cast from type ‘int (foo::*)()’ to type ‘void*’
prog.cpp:6: warning: unused variable ‘p’
stdout

Standard output is empty