title: Virtual destructor and undefined behavior
body: <p>This question is different than '<em>When/why should I use a <code>virtual</code> destructor?</em>'.</p>
  
  <pre><code>struct B {
    virtual void foo ();
    ~B() {}  // &lt;--- not virtual
  };
  struct D : B {
    virtual void foo ();
    ~D() {}
  };
  B *p = new D;
  delete p;  // D::~D() is not called
  </code></pre>
  
  <p><strong>Questions</strong>:</p>
  
  <ol>
  <li>Can this be classified as an undefined behavior (we are aware that <code>~D()</code> is not going to be called <em>for sure</em>)?</li>
  <li>What if <code>~D()</code> is empty. Will it affect the code in any way?</li>
  <li>Upon using <code>new[]</code>/<code>delete[]</code> with <code>B* p;</code>, the <code>~D()</code> will certainly not
  get called, irrespective of <code>virtual</code>ness of the destructor. Is it
  an undefined behavior or well defined behavior?</li>
  </ol>