title: clang: no out-of-line virtual method definitions (pure abstract C++ class)
body: <p>I'm trying to compile the following simple C++ code using Clang-3.5:</p>
  
  <p>test.h:</p>
  
  <pre><code>class A
  {
    public:
      A();
      virtual ~A() = 0;
  };
  </code></pre>
  
  <p>test.cc:</p>
  
  <pre><code>#include "test.h"
  
  A::A() {;}
  A::~A() {;}
  </code></pre>
  
  <p>The command that I use for compiling this (Linux, uname -r: 3.16.0-4-amd64):</p>
  
  <pre><code>$clang-3.5 -Weverything -std=c++11 -c test.cc
  </code></pre>
  
  <p>And the error that I get:</p>
  
  <pre><code>./test.h:1:7: warning: 'A' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Wweak-vtables]
  </code></pre>
  
  <p>Any hints why this is emitting a warning? The virtual destructor is not inlined at all. Quite the opposite, there's a out-of-line definition provided in test.cc. What am I missing here?</p>
  
  <p><strong>Edit</strong> </p>
  
  <p>I don't think that this question is a duplicate of :
  <a href="https://stackoverflow.com/questions/23746941/what-is-the-meaning-of-clangs-wweak-vtables">What is the meaning of clang&#39;s -Wweak-vtables?</a>
  as Filip Roséen suggested. In my question I specifically refer to pure abstract classes (not mentioned in the suggested duplicate). I know how <code>-Wweak-vtables</code> works with non-abstract classes and I'm fine with it. In my example I define the destructor (which is pure abstract) in the implementation file. This should prevent Clang from emitting any errors, even with <code>-Wweak-vtables</code>.</p>