https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86583
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |SUSPENDED Last reconfirmed| |2018-07-19 Summary|exception specification of |[DR 1854] exception |explicitly defaulted |specification of explicitly |destructor does not match |defaulted destructor does |the calculated one |not match the calculated | |one Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to zhonghao from comment #0) > g++ accepts the code, but I think it shouldn't be. GCC defines the members as deleted, so you don't get an error unless you try to use them. That seems to be correct according to [dcl.fct.def.default] p2 which has a very similar example: ~S() noexcept(false) = default; // deleted: exception specification does not match I think Clang might implement the suggested direction for https://wg21.link/cwg1854 but GCC is correct according to the current standard. > In fact, g++4.9.0 rejects the code: 4.9.0 accepts it, but 4.8.x rejects it.