title: i call delete, but my d-tor isn't called, why?
body: <p>I wrote this piece of code ( I know it's an awful design but this is just a simplified simulation for real objects in the code that i'm working with, trying to inspect some memory related bug), when running it with debugger, i can reach the "delete" in the Holder d-tor, but the d-tor of TrueObject is never called. why is that? (compiled with vs2017)</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  using namespace std;
  
  class ComonBaseA {
  public:
      ComonBaseA() { cout &lt;&lt; "ComonBaseA" &lt;&lt; endl; }
      virtual ~ComonBaseA() { cout &lt;&lt; "~ComonBaseA"&lt;&lt;endl; }
  };
  
  class Proxy : public ComonBaseA {
  public:
      Proxy() { cout &lt;&lt; "Proxy" &lt;&lt; endl; }
      void invoke();
      ~Proxy();
  private:
      ComonBaseA* imp = nullptr;
  
  };
  
  class A : public Proxy {
  public:
      A() { cout &lt;&lt; "A with invoke" &lt;&lt; endl; invoke();}
      A(bool bNoProxy) { cout &lt;&lt; "A (empty)" &lt;&lt; endl; }
      virtual ~A() { cout &lt;&lt; "~A"&lt;&lt;endl; }
  };
  
  class TrueObject;
  
  class Holder {
  public:
      Holder() { cout &lt;&lt; "Holder" &lt;&lt; endl; }
      void hold(TrueObject* t) {
          cout &lt;&lt; "holding" &lt;&lt; endl;
          _t = t;
      }
      ~Holder() {
          cout &lt;&lt; "~Holder" &lt;&lt; endl;
          delete _t;
  
      }
  
  private:
      TrueObject* _t = nullptr;
  };
  
  class TrueObject {
  public:
      TrueObject(Holder* h) { 
          cout &lt;&lt; "TrueObject" &lt;&lt; endl;
          h-&gt;hold(this);
      }
      ~TrueObject() { 
          cout &lt;&lt; "~TrueObject"&lt;&lt;endl; 
      }
  };
  
  
  
  class AImp : public A, public Holder {
  public:
      AImp() : A(true), Holder() {
          cout &lt;&lt; "AImp" &lt;&lt; endl;
          _t = new TrueObject(this);
      }
      ~AImp() { cout &lt;&lt; "~AImp"&lt;&lt;endl; }
  
  private:
      TrueObject* _t = nullptr;
  };
  
  
  void Proxy::invoke() {
      imp = new AImp();
  }
  
  Proxy::~Proxy() {
      cout &lt;&lt; "~Proxy"&lt;&lt;endl;
      delete imp;
  }
  
  
  int main()
  {
      A a;
      return 0;
  }
  
  
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>ComonBaseA
  Proxy
  A with invoke
  ComonBaseA
  Proxy
  A (empty)
  Holder
  AImp
  TrueObject
  holding
  ~A
  ~Proxy
  ~AImp
  ~Holder
  ~A
  ~Proxy
  ~ComonBaseA
  ~ComonBaseA
  </code></pre>