title: C++11 virtual destructors and auto generation of move special functions
body: <p>The rules for auto generating special move functions (constructor and assignment operator) in C++11 specify that no destructor can be declared. The logic is presumably that, if you need to do something special in destruction, that a move may not be safe.</p>
  
  <p>However, for proper destructor calls in polymorphism, it is necessary to declare a base classes' destructor as virtual (otherwise deleting an instance of a sub class through a pointer of its base class will not properly chain the destructor).</p>
  
  <p>I'm assuming, then, that even an empty destructor would prevent the compiler from automatically generating a special move functions. As in:</p>
  
  <pre><code>class Base {
      virtual ~Base() { }
  };
  </code></pre>
  
  <p>You can, however, default the destructor, as in:</p>
  
  <pre><code>class Base {
      virtual ~Base() = default;
  }
  </code></pre>
  
  <p>So question 1: Will this allow the compiler to auto generate special move functions?</p>
  
  <p>There is a problem with the explicit default destructor, however. In at least the case of GCC 4.8.2, the signature is implicitly changed to noexcept. As in:</p>
  
  <pre><code>class Base {
      virtual ~Base() = default; // compiler changes to:
      // virtual ~Base() noexcept;
  }
  </code></pre>
  
  <p>While I have no problem with noexcept in a destructor, this would break the following "client" code:</p>
  
  <pre><code>class Sub : public Base {
      virtual ~Sub(); // this declaration is now "looser" because of no noexcept
  }
  </code></pre>
  
  <p>So question 2 is more to the point: is there a way to allow auto generation of special move functions in C++11 and allow proper destructor chaining to sub classes (as described above), all without breaking subclass ("client") code?</p>