fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct a { static void operator delete (void *p) { ::delete p; } };
  6. struct b { static void operator delete (void *p) { ::operator delete(p); } };
  7.  
  8. int main()
  9. {
  10. delete new a();
  11. delete new b();
  12.  
  13. cout << "Done :)" << endl;
  14.  
  15. return DON_T_COMPILE_ME;
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In static member function ‘static void a::operator delete(void*)’:
prog.cpp:5:62: warning: deleting ‘void*’ is undefined [-Wdelete-incomplete]
 struct a { static void operator delete (void *p)  { ::delete p; } };
                                                              ^
prog.cpp: In function ‘int main()’:
prog.cpp:15:10: error: ‘DON_T_COMPILE_ME’ was not declared in this scope
   return DON_T_COMPILE_ME;
          ^~~~~~~~~~~~~~~~
stdout
Standard output is empty