314. Is the stack unwound when terminate() is called?

Section: [terminate] Status: NAD Submitter: Detlef Vollmann Opened: 2001-04-11 Last modified: 2016-01-28 10:19:27 UTC

Priority: Not Prioritized

View all other issues in [terminate].

View all issues with NAD status.


The standard appears to contradict itself about whether the stack is unwound when the implementation calls terminate().


Calls the terminate_handler function in effect immediately after evaluating the throw-expression (lib.terminate.handler), if called by the implementation [...]

So the stack is guaranteed not to be unwound.

But from 15.3p9:

[...]whether or not the stack is unwound before this call to terminate() is implementation-defined (except.terminate).

And 15.5.1 actually defines that in most cases the stack is unwound.

Proposed resolution:


There is definitely no contradiction between the core and library clauses; nothing in the core clauses says that stack unwinding happens after terminate is called. does not say anything about when terminate() is called; it merely specifies which terminate_handler is used.