<html>
<head>
<title>Deducing "noexcept" for destructors</title>

<style type="text/css">
  ins { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  del { text-decoration:line-through; background-color:#FFA0A0 }
</style>
</head>

<body>
Jens Maurer<br>
2010-11-11<br/>
N3204=10-0194

<h1>Deducing "noexcept" for destructors</h1>

This proposed wording implements Alisdair's rules for
deducing "noexcept" on destructors, addressing FCD national body
comments FI 17 and GB 40.   It is a follow-up paper to N3166=10-0156
"Destructors default to noexcept" by David Svoboda, which suggested to
mark all destructors "noexcept(true)" unconditionally.
<p>
The motivating example is:

<pre>
template&lt;class T, class U>
class C : public T {
  U u;
  ~C() { ... }
};
</pre>
Unless an explicit "noexcept" annotation is given, the destructor
C::~C() should be "noexcept(true)" if none
of the base or member destructors is "noexcept(false)", regardless of
the contents of the destructor's <em>function-body</em>.

<p>

Add a new paragraph after 12.4 class.dtor paragraph 2:
<blockquote>
<ins>A declaration of a destructor that does not have an
<em>exception-specification</em> is implicitly considered to have the
same <em>exception-specification</em> as an implicit declaration
(15.4 except.spec).</ins>
</blockquote>

Change in 12.4 class.dtor paragraph 5:
<blockquote>
Before the defaulted destructor for a class is implicitly defined, all
the non-user-provided destructors for its base classes and its
non-static data members shall have been implicitly defined.
<del>[ Note: an implicitly-declared destructor has an
exception-specification (15.4 except.spec).  An explictly defaulted
definition has no implicit <em>exception-specification</em>.
-- end note ]</del>
</blockquote>

</body>
</html>
