title: Undefined reference to vtable error affected by inline constructor
body: <p>While there are other questions on stack overflow which deal with the 'undefined reference to vtable' error message. The following code either compiles or doesn't compile depending on whether the no-args constructor C() is implemented in-line or not. I know that the member function m() should be pure virtual and that would be the correct change to make in order to fix the issue. What is confusing to me is that it can be made to compile with an apparently unrelated change.</p>
  
  <p>The following code does not compile with g++ (4.6.3 on ubuntu 64 bit) and produces the expected 'undefined reference to vtable for C' message (which for the record is still a terrible error message considering the problem is with m())</p>
  
  <p>Header.h</p>
  
  <pre><code>#ifndef HEADER_H
  #define HEADER_H
  
  class C
  {
    public:
      C();
      virtual void m();
  };
  
  #endif
  </code></pre>
  
  <p>Implementation.cpp</p>
  
  <pre><code>#include "Header.h"
  C::C() {}
  </code></pre>
  
  <p>Main.cpp</p>
  
  <pre><code>#include "Header.h"
  int main()
  {
     return 0;
  }
  </code></pre>
  
  <p><b>The following unrelated changes allows for compilation:</b></p>
  
  <ul>
  <li>Remove non in-lined implementation for C::C() from Implementation.cpp</li>
  <li>Add trivial in-line implementation for C() to class in Header.h</li>
  </ul>
  
  <p>Why does this allow for compilation? Is this a compiler bug, optimizer issue or dark corner of the standard suprise?</p>