fork download
  1. #include <iostream>
  2.  
  3. struct A
  4. {
  5. ~A() { throw 2; }
  6. };
  7.  
  8. struct B: A
  9. {
  10. int x;
  11. };
  12. struct C
  13. {
  14. int x;
  15. };
  16.  
  17. int main()
  18. {
  19. try {
  20. A a;
  21. }
  22. catch (...) {
  23. std::cout << "OK\n";
  24. std::cout << (sizeof(B) == sizeof(C));
  25. }
  26. }
Runtime error #stdin #stdout #stderr 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'int'