fork download
  1. #include <stdlib.h>
  2. #include <iostream>
  3.  
  4. void* qq;
  5.  
  6. struct a
  7. {
  8. virtual ~a(){ std::cout << "dtor called" << std::endl; };
  9.  
  10. void* operator new[] (size_t s)
  11. {
  12. void* p = malloc(s);
  13. qq = p;
  14. return p;
  15. }
  16.  
  17. void operator delete[] (void* p)
  18. {
  19. free(p);
  20. }
  21. };
  22.  
  23. struct b
  24. {
  25. int x;
  26. };
  27.  
  28. struct c: b, a
  29. {
  30. int y;
  31. };
  32.  
  33. int main ()
  34. {
  35. c* cc = new c[10];
  36. a::operator delete[] (qq);
  37. }
Success #stdin #stdout 0.01s 2852KB
stdin
Standard input is empty
stdout
Standard output is empty