Under certain circumstances, terminating a function by destructor, operator delete
or oeprator delete[]
by throwing an exception can trigger undefined behavior.
...
As such, deallocation functions (object, array, and placement forms at either global or class scope) must not terminate by throwing an exception. Do not declare such functions to be noexcept(false)
, however . However it is acceptable to rely on the implicit noexcept(true)
specification or declare noexcept
explicitly on the function signature.
...