title: clang: -Wweak-vtable for defaulted virtual destructor is probably inappropriate
body: <p>I know about similar questions, but still would like to understand if described warning is pointless or not.</p>
  
  <p><strong>Potential duplicates could be</strong>:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/28786473/clang-no-out-of-line-virtual-method-definitions-pure-abstract-c-class">clang: no out-of-line virtual method definitions (pure abstract C++ class)</a></li>
  <li><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></li>
  </ul>
  
  <p>but I still have a feeling, this question is different.</p>
  
  <p>Let's imagine that I have a base class implemented as <a href="https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Non-Virtual_Interface" rel="nofollow noreferrer">NVI</a>.</p>
  
  <pre><code>  struct server_strategy
    {
      explicit server_strategy(std::string name) : name_{std::move(name)} {}
      virtual ~server_strategy()=default;
  
      zmq::message_t handle_message(zmq::message_t request)
      {
        // ...
      }
  
      std::string const&amp; log_channel()const {return name_;}
  
    private:
      virtual zmq::message_t do_handle_message(zmq::message_t request) =0;
  
  
    private:
      const std::string name_;
    };
  </code></pre>
  
  <p><br/></p>
  
  <p><em>Compiling this class makes Clang issuing the warning:</em></p>
  
  <pre><code>error: 'server_strategy' has no out-of-line virtual method definitions;
  its vtable will be emitted in every translation unit [-Werror,-Wweak-vtables]
  </code></pre>
  
  <p><strong>Question is about <code>=default</code> keyword and not about where virtual destructor's impl will finally land!</strong></p>
  
  <ul>
  <li>Why does <code>=default</code> makes sense at all in context of virtual destructors? </li>
  <li>Don't you think that this warning is overkill in that context? </li>
  </ul>
  
  <p>I mean if I <strong>explicitly declare virtual destructor as defaulted</strong> than I probably don't want to introduce an additional .cpp file and I know that compiler is going to pick any translation unit for its implementation. It'd be handy to let library authors avoid these warnings, but switching to defaulted virtual destructors instead of inline implementation, but it turns out that <strong>library authors have no other choice than deal with pragmas and conditional define macros</strong> which compiler is being used to disable these warnings.</p>