Skip to content

added noexcept(false) specifier on throwing destructor

Recently the throw(...) specifier was removed or replaced with noexcept specifier since the former one is deprecated in C++11 and gives an error in C++17. On some functions a specification should not be removed, because they are implicitly noexcept(true) also if these functions contains a throw statement. These functions include destructors, default constructors, copy constructors, move constructors, copy-assignment operators, move-assignment operators, deallocation functions (with some exceptions). If not marked otherwise, all other functions should be implicitly noexcept(false). See http://en.cppreference.com/w/cpp/language/noexcept_spec and for the case of destructors https://akrzemi1.wordpress.com/2013/08/20/noexcept-destructors/

Thus, I have added a noexcept(false) specifier on a throwing destructor. Otherwise a warning that "throw will always call terminate()" may be shown by the compiler.

Merge request reports