title: g++-4.8.1 thinks that an explicitly-declared destructor with no exception specification is always noexcept(true)
body: <p>Consider the following program:</p>
  
  <pre><code>#include &lt;type_traits&gt;
  
  struct Thrower
  {
      ~Thrower() noexcept(false) { throw 1; }
  };
  
  struct Implicit
  {
      Thrower t;
  };
  static_assert(!std::is_nothrow_destructible&lt;Implicit&gt;::value, "Implicit");
  
  struct Explicit
  {
      ~Explicit() {}
  
      Thrower t;
  };
  static_assert(!std::is_nothrow_destructible&lt;Explicit&gt;::value, "Explicit");
  </code></pre>
  
  <p>With <code>g++-4.8.1</code>, there is a static assertion failure on <code>Explicit</code> -- it seems to think that <code>~Explicit()</code> is <code>noexcept</code>. This does not match my expectations. According to §12.4.3:</p>
  
  <blockquote>
    <p>A declaration of a destructor that does not have an exception-specification is implicitly
    considered to have the same exception-specification as an implicit declaration</p>
  </blockquote>
  
  <p>The funny thing here is the check of <code>Implicit</code> seems to be behaving according to my interpretation of §15.4.14 (through §12.4.7).</p>
  
  <blockquote>
    <p>...If <em>f</em> is an...destructor...it's implicit exception-specification specifies...f has the exception-specification <code>noexcept(true)</code> if every function it directly invokes allows no exceptions.</p>
  </blockquote>
  
  <p><code>g++-4.7</code> lacks <code>is_nothrow_destructable</code>, I wrote my own to check the behavior in 4.7. The program seems to compile perfectly fine. I reserve the right for this to be completely wrong and the source of my confusion:</p>
  
  <pre><code>template &lt;typename T&gt;
  struct is_nothrow_destructible
  {
      static constexpr bool value = noexcept(std::declval&lt;T&gt;().~T());
  };
  </code></pre>
  
  <p><strong>TL;DR:</strong> Why does <code>g++-4.8.1</code> think that an explicitly-declared destructor with no exception specification is <em>always</em> <code>noexcept(true)</code>?</p>
  
  <hr>
  
  <p><strong>Update</strong>: I opened a bug on this: <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57645" rel="nofollow">57645</a>. If you really need to work around this issue, you can add an exception specification to the destructor (like <code>Thrower</code> has in the example).</p>