fork(1) download
  1. #include <stdio.h>
  2.  
  3. class B {
  4. public:
  5. B() {
  6. printf("B::ctor();\n");
  7. return;
  8. }
  9.  
  10. ~B() {
  11. printf("B::dtor();\n");
  12. return;
  13. }
  14. };
  15.  
  16. class A {
  17. class B b;
  18.  
  19. public:
  20. A() : b() {
  21. printf("A::ctor();\n");
  22. throw 0;
  23. }
  24.  
  25. ~A() {
  26. printf("A::dtor();\n");
  27. }
  28. };
  29.  
  30. int f(A* a) {
  31. printf("f();");
  32. return 0;
  33. }
  34.  
  35. int main(void) {
  36. try {
  37. auto a = f(new A());
  38. } catch (...) {
  39. }
  40. return 0;
  41. }
  42.  
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
B::ctor();
A::ctor();
B::dtor();