What happens when a destructor lets an exception escape, especially during stack unwinding?
Show answer and explanation
A destructor's implicit exception specification depends on the destructors of its bases and members and is normally non-throwing; an exception escaping a noexcept destructor calls std::terminate. Even an explicitly noexcept(false) destructor causes termination if it throws while another exception is already unwinding and both would escape. Destructors should therefore perform reliable non-throwing cleanup, catch and contain failures they can handle, and expose a separate explicit close or commit operation when the caller must observe an error. Relying only on a destructor cannot report recoverable failure safely.
A destructor's implicit exception specification depends on the destructors of its bases and members and is normally non-throwing; an exception escaping a noexcept destructor calls std::terminate. Even an explicitly noexcept(false) destructor causes termination if it throws while another exception is already unwinding and both would escape. Destructors should therefore perform reliable non-throwing cleanup, catch and contain failures they can handle, and expose a separate explicit close or commit operation when the caller must observe an error. Relying only on a destructor cannot report recoverable failure safely.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.