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