This is a bit misleading; it's fine to throw an exception handler (which I would understand "when handling an exception") if there is another handler to catch it.
The problem is that you selected an exception from the destructor of the object, which is destroyed during the unwinding of the stack. In this case, there are two unhandled exceptions, and the usual exception mechanism can deal with only one; therefore, the answer should call terminate .
Example:
struct dodgy {~dodgy() {throw "Don't do this!";}}; try { dodgy d; throw 1; } catch (...) {
Mike seymour
source share