Title
Exceptions during copy to exception object
Status
cd3
Section
14.2 [except.throw]
Submitter
Daniel Krügler

Created on 2012-05-11.00:00:00 last changed 131 months ago

Messages

Date: 2013-04-15.00:00:00

[Moved to DR at the April, 2013 meeting.]

Date: 2012-08-15.00:00:00

Proposed resolution (August, 2012):

Change 14.2 [except.throw] paragraph 7 as follows:

If the exception handling mechanism, after completing evaluation of the expression to be thrown the initialization of the exception object but before the exception is caught activation of a handler for the exception, calls a function that exits via an exception, std::terminate is called (14.6.2 [except.terminate]). [Example:

  struct C {
    C() { }
    C(const C&) { throw 0; }
      if (std::uncaught_exception()) {
        throw 0;    // throw during copy to handler's exception-declaration object (14.4 [except.handle])
      }
    }
  };

  int main() {
    try {
      throw C();   // calls std::terminate() if construction of the handler's
                   // exception-declaration object is not elided (11.4.5.3 [class.copy.ctor])
    } catch(C) { }
  }

end example]

Date: 2012-05-11.00:00:00

According to 14.2 [except.throw] paragraph 7,

If the exception handling mechanism, after completing evaluation of the expression to be thrown but before the exception is caught, calls a function that exits via an exception, std::terminate is called (14.6.2 [except.terminate]).

This wording was overlooked in the resolution for issue 475 and should be changed, along with the following example, to indicate that std::terminate will be called for an uncaught exception only after initialization of the exception object is complete.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: + msg4433
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-11-03 00:00:00adminsetstatus: tentatively ready -> ready
2012-09-24 00:00:00adminsetmessages: + msg3886
2012-05-11 00:00:00admincreate