fork download
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. class A
  5. {
  6. private:
  7.  
  8. public:
  9. A()
  10. {
  11. std::cout << "A::A()" << std::endl;
  12. }
  13. ~A()
  14. {
  15. throw 1;
  16. std::cout << "A::~A(int)" << std::endl;
  17. }
  18. };
  19.  
  20.  
  21.  
  22. int main()
  23. {
  24.  
  25. std::set_terminate([](){ std::cout << "terminate called\n"; exit(1);});
  26.  
  27. A* p = nullptr;
  28.  
  29. try
  30. {
  31. p = new A();
  32. delete p;
  33. }
  34. catch(...)
  35. {
  36. std::cout << "catch(...)" << std::endl;
  37. }
  38.  
  39. return 0;
  40. }
  41.  
Runtime error #stdin #stdout 0s 4496KB
stdin
Standard input is empty
stdout
A::A()
terminate called