Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: minor editorial change

...

Object destructors are likely to be called during stack unwinding as a result of an exception being thrown. If the destructor itself throws an exception, having been called as the result of an exception being thrown, then the function std::terminate() is called with the default effect of calling std::abort() [ISO/IEC 14882-2014]When std::abort() is called, no further objects are destroyed, resulting in an indeterminate program state and undefined behavior. Do not terminate a destructor by throwing an exception. 

...

Bibliography

[Henricson 971997]Recommendation 12.5, Do not let destructors called during stack unwinding throw exceptions
[ISO/IEC 14882-2014]

Subclause 3.4.7.2, "Deallocation Functions"
Subclause 15.2, "Constructors and Destructors"
Subclause 15.3, "Handling an Exception"
Subclause 15.4, "Exception Specifications"

[Meyers 2005]Item 8, "Prevent Exceptions from Leaving Destructors"
[Sutter 2000]"Never allow exceptions from escaping destructors or from an overloaded operator delete()" (p. 29)

...