...
A destructor should perform the same way whether or not there is an active exception. Typically, this means that it should invoke only operations that do not throw exceptions, or it should handle all exceptions and not rethrow them (even implicitly). In this compliant solution, all exceptions are caught in the function-try-block and the exception will not be rethrown because control does not reach the end of the handler due to the explicit return
statement. This handler will catch the exception thrown by Bad::~Bad()
when bad_member
is destroyed, and it will also catch any exceptions thrown within the the compound statement of the function-try-block.
...