先日comp.std.c++に投稿したときに教えてもらって知りました。
暗黙定義される自明(trivial)なデストラクタはnoexceptとなるのですが、明示的にデフォルト定義した非自明(non trivial)なデストラクタはnoexceptを指定する必要がなく暗黙にnoexceptとなるそうです。
以下のプログラムのCクラスがそれです。
struct A { // trivial destructor, noexcept }; struct B { // non trivial destructor, explicit noexcept ~B() noexcept = default; }; struct C { // non trivial default destructor, implicit noexcept ~C() = default; }; struct D { // non trivial destructor ~D() {} }; /* struct E { ~E() noexcept(false) = default; // error! }; */ int main() { A a; B b; C c; D d; static_assert(noexcept(a.~A()), ""); static_assert(noexcept(b.~B()), ""); static_assert(noexcept(c.~C()), ""); static_assert(noexcept(d.~D()), ""); }
余談ですが、デストラクタをデフォルト定義してnoexcept(false)するとコンパイルエラーになるようです。
missing description : error_category's destructor - comp.std.c++