title: How to correctly resolve incompatible throw specifiers with implicit virtual destructors?
body: <p>This code does not compile:</p>
  
  <pre><code>#include &lt;QString&gt;
  
  /* relevant part:
  struct QString 
  {
    ~QString() noexcept(false) {};
  };
  */
  
  class Base
  {
  public:
      virtual ~Base() = default;
  };
  
  class Derived : public Base
  {
      QString string_;
  };
  
  int main()
  {
      return 0;
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>error: looser throw specifier for 'virtual Derived::~Derived()'
  error:   overriding 'virtual Base::~Base() noexcept (true)'
  </code></pre>
  
  <p>I have no experience with using exceptions, but I think that the problem is that the <code>QString</code> destructor has no exception specifier and therefore the implicitly created <code>Derived::~Derived</code> has also no exception specifier. This is incompatible with the implicit <code>Base::~Base</code> which is <code>noexcept(true)</code>. </p>
  
  <p>If I exclude the <code>QString</code> or replace it with a class with <code>noexcept(true)</code> (such as <code>std::string</code>), the code compiles.</p>
  
  <p>At first I thought that I could solve this by declaring both destructors as <code>noexcept(false)</code>:</p>
  
  <pre><code>virtual ~Base() noexcept(false) = default;
  virtual ~Derived() noexcept(false) = default;
  </code></pre>
  
  <p>But all I get is:</p>
  
  <pre><code>error: function 'virtual Base::~Base()' defaulted on its first declaration 
         with an exception-specification that differs from 
         the implicit declaration 'Base::~Base()'
  error: looser throw specifier for 'virtual Derived::~Derived() noexcept (false)'
  error: overriding 'virtual Base::~Base() noexcept (true)'
  </code></pre>
  
  <p>I do not use exceptions anywhere in my code, so the thing I am looking for is just a "fix".</p>