title: Why is delete operator required for virtual destructors
body: <p>In a freestanding context (no standard libraries, e.g. in operating system development) using g++ the following phenomenon occurs:</p>
  
  <pre><code>class Base {
  public:
     virtual ~Base() {}
  };
  
  class Derived : public Base {
  public:
      ~Derived() {}
  };
  
  int main() {
      Derived d;
  }
  </code></pre>
  
  <p>When linking it states something like this: <code>undefined reference to operator delete(void*)</code></p>
  
  <p>Which clearly means that g++ is generating calls to delete operator even though there are zero dynamic memory allocations. This doesn't happen if destructor isn't virtual. </p>
  
  <p>I suspect this has to do with the generated vtable for the class but I'm not entirely sure. <strong>Why does this happen?</strong></p>
  
  <p>If I must not declare a delete operator due to the lack of dynamic memory allocation routines, <strong>is there a work around?</strong></p>
  
  <p><strong>EDIT1:</strong></p>
  
  <p>To successfully reproduce the problem in g++ 5.1 I used:</p>
  
  <p>g++ -ffreestanding -nostdlib foo.cpp</p>