fork download
  1. #include <iostream>
  2.  
  3. struct A
  4. {
  5. ~A()
  6. {
  7. std::cout << "A::~A" << std::endl;
  8. }
  9. };
  10.  
  11. struct B
  12. {
  13. A a;
  14. };
  15.  
  16. int main()
  17. {
  18. B b;
  19. std::cout << "Calling b.~B()" << std::endl;
  20. b.~B();
  21. std::cout << "Done" << std::endl;
  22. }
  23.  
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
Calling b.~B()
A::~A
Done
A::~A