fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct X
  5. {
  6. ~X() { std::cout << "3\n"; }
  7.  
  8. void f() {}
  9. } x;
  10.  
  11.  
  12. struct Y
  13. {
  14. ~Y()
  15. {
  16. static struct Z
  17. {
  18. ~Z()
  19. {
  20. x.f();
  21. std::cout << "2\n";
  22. }
  23. } z;
  24.  
  25. std::cout << "1\n";
  26. }
  27. } y;
  28.  
  29. int main() {
  30. return 0;
  31. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1
2
3