fork download
  1. struct B;
  2. struct A {
  3. B* b;
  4. };
  5.  
  6. struct B {
  7. A* a;
  8. B() : a(new A{this}) {}
  9. ~B() { delete a; }
  10. };
  11.  
  12. int main() {
  13. B* b = new B;
  14. // A* a = b->a;
  15. const A* a = b->a;
  16. delete a->b;
  17. }
Success #stdin #stdout 0s 2956KB
stdin
Standard input is empty
stdout
Standard output is empty