title: Are all unused undefined methods allowed?
body: <p>Here’s a class with an undefined method. It seems compilers allow instances of this class to be constructed, so long as the undefined member function is never called:</p>
  
  <pre><code>struct A {
      void foo();
  };
  
  int main() {
      A a;      // &lt;-- Works in both VC2013 and g++
      a.foo();  // &lt;-- Error in both VC2013 and g++
  }
  </code></pre>
  
  <p>Here’s a similar situation, but one that involves inheritance. Subclass <code>Bar</code> extends base class <code>Foo</code>. <code>Foo</code> defines a method <code>g()</code>. <code>Bar</code> declares the same-named method but does not define it:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  struct Foo {
      void g() { std::cout &lt;&lt; "g\n"; }
  };
  
  struct Bar : Foo {
      void g();
  };
  
  int main() {
      Bar b;      // Works in both VC2013 and g++
      b.Foo::g(); // Works in both VC2013 and g++
      b.g();      // Error in both VC2013 and g++
  }
  </code></pre>
  
  <p>Here's a variation of the above. The only difference here is that <code>g()</code> is <code>virtual</code> to both <code>Foo</code> and <code>Bar</code>:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  struct Foo {
      virtual void g() { std::cout &lt;&lt; "g\n"; }
  };
  
  struct Bar : Foo {
      virtual void g();
  };
  
  int main() {
      Bar b;      // Works in g++. But not in VC2013, which gives
                  // 'fatal error LNK1120: 1 unresolved externals'
  
      b.Foo::g(); // Works in g++, but VC2013 already failed on b's construction
      b.g();      // Error in g++, but VC2013 already failed on b's construction
  }
  </code></pre>
  
  <p>See the code comments for contrast of different behavior between VC2013 and g++. </p>
  
  <ol>
  <li>Which compiler is correct, if any?</li>
  <li>Why does VC2013's compiler have some different complaints in its version with the <code>virtual</code> keyword compared to the one in its version without the <code>virtual</code> keyword?</li>
  <li>Are unused undefined methods always allowed? If not, what are all the cases in which they're
  not allowed?</li>
  <li>Does <code>Bar</code>’s declaration of <code>g()</code> count as overriding
  even when <code>Bar</code> doesn't provide a definition?</li>
  </ol>