Title
At what point is std::unexpected called?
Status
nad
Section
14.5 [except.spec]
Submitter
UK

Created on 2009-03-03.00:00:00 last changed 176 months ago

Messages

Date: 2009-10-15.00:00:00

Rationale (October, 2009):

The point at which std::unexpected is called is specified in _N4606_.15.5.2 [except.unexpected] paragraph 1:

If a function with an exception-specification throws an exception that is not listed in the exception-specification, the function std::unexpected() is called (_N4606_.D.6 [exception.unexpected]) immediately after completing the stack unwinding for the former function.

That is, it will be called after any local automatic objects and temporaries are destroyed and before any other objects, such as function arguments, are destroyed. (See 7.6.1.3 [expr.call] paragraph 4: “The initialization and destruction of each parameter occurs within the context of the calling function.”)

Date: 2022-11-20.07:54:16
N2800 comment UK 135

It is unclear whether std::unexpected is called before or after the destruction of function arguments, partially-constructed bases and members (when called from a constructor or destructor), etc.

History
Date User Action Args
2009-11-08 00:00:00adminsetmessages: + msg2488
2009-11-08 00:00:00adminsetstatus: open -> nad
2009-03-03 00:00:00admincreate