From Jason Turner

[except.terminate]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp5uzukyjv/{from.md → to.md} +114 -13
tmp/tmp5uzukyjv/{from.md → to.md} RENAMED
@@ -1,9 +1,11 @@
1
  ### The `std::terminate` function <a id="except.terminate">[[except.terminate]]</a>
2
 
3
- In some situations exception handling is abandoned for less subtle error
4
- handling techniques.
 
 
5
 
6
  [*Note 1*:
7
 
8
  These situations are:
9
 
@@ -11,13 +13,16 @@ These situations are:
11
  initialization of the exception object but before activation of a
12
  handler for the exception [[except.throw]], calls a function that
13
  exits via an exception, or
14
  - when the exception handling mechanism cannot find a handler for a
15
  thrown exception [[except.handle]], or
16
- - when the search for a handler [[except.handle]] encounters the
17
- outermost block of a function with a non-throwing exception
18
- specification [[except.spec]], or
 
 
 
19
  - when the destruction of an object during stack unwinding
20
  [[except.ctor]] terminates by throwing an exception, or
21
  - when initialization of a non-block variable with static or thread
22
  storage duration [[basic.start.dynamic]] exits via an exception, or
23
  - when destruction of an object with static or thread storage duration
@@ -40,23 +45,119 @@ These situations are:
40
  object of type `std::thread` that refers to a joinable thread
41
  [[thread.thread.destr]], [[thread.thread.assign]], or
42
  - when a call to a `wait()`, `wait_until()`, or `wait_for()` function on
43
  a condition variable
44
  [[thread.condition.condvar]], [[thread.condition.condvarany]] fails to
45
- meet a postcondition.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  — *end note*]
48
 
49
- In such cases, the function `std::terminate` is invoked
50
- [[exception.terminate]]. In the situation where no matching handler is
51
- found, it is *implementation-defined* whether or not the stack is
52
- unwound before `std::terminate` is invoked. In the situation where the
53
- search for a handler [[except.handle]] encounters the outermost block of
54
- a function with a non-throwing exception specification [[except.spec]],
55
- it is *implementation-defined* whether the stack is unwound, unwound
56
  partially, or not unwound at all before the function `std::terminate` is
57
  invoked. In all other situations, the stack shall not be unwound before
58
  the function `std::terminate` is invoked. An implementation is not
59
  permitted to finish stack unwinding prematurely based on a determination
60
  that the unwind process will eventually cause an invocation of the
61
  function `std::terminate`.
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ### The `std::terminate` function <a id="except.terminate">[[except.terminate]]</a>
2
 
3
+ Some errors in a program cannot be recovered from, such as when an
4
+ exception is not handled or a `std::thread` object is destroyed while
5
+ its thread function is still executing. In such cases, the function
6
+ `std::terminate` [[exception.terminate]] is invoked.
7
 
8
  [*Note 1*:
9
 
10
  These situations are:
11
 
 
13
  initialization of the exception object but before activation of a
14
  handler for the exception [[except.throw]], calls a function that
15
  exits via an exception, or
16
  - when the exception handling mechanism cannot find a handler for a
17
  thrown exception [[except.handle]], or
18
+ - when the search for a handler [[except.handle]] exits the function
19
+ body of a function with a non-throwing exception specification
20
+ [[except.spec]], including when a contract-violation handler invoked
21
+ from an evaluation of a function contract assertion
22
+ [[basic.contract.eval]] associated with the function exits via an
23
+ exception, or
24
  - when the destruction of an object during stack unwinding
25
  [[except.ctor]] terminates by throwing an exception, or
26
  - when initialization of a non-block variable with static or thread
27
  storage duration [[basic.start.dynamic]] exits via an exception, or
28
  - when destruction of an object with static or thread storage duration
 
45
  object of type `std::thread` that refers to a joinable thread
46
  [[thread.thread.destr]], [[thread.thread.assign]], or
47
  - when a call to a `wait()`, `wait_until()`, or `wait_for()` function on
48
  a condition variable
49
  [[thread.condition.condvar]], [[thread.condition.condvarany]] fails to
50
+ meet a postcondition, or
51
+ - when a callback invocation exits via an exception when requesting stop
52
+ on a `std::stop_source` or a `std::inplace_stop_source`
53
+ [[stopsource.mem]], [[stopsource.inplace.mem]], or in the constructor
54
+ of `std::stop_callback` or `std::inplace_stop_callback`
55
+ [[stopcallback.cons]], [[stopcallback.inplace.cons]] when a callback
56
+ invocation exits via an exception, or
57
+ - when a `run_loop` object is destroyed that is still in the `running`
58
+ state [[exec.run.loop]], or
59
+ - when `unhandled_stopped` is called on a `with_awaitable_senders<T>`
60
+ object [[exec.with.awaitable.senders]] whose continuation is not a
61
+ handle to a coroutine whose promise type has an `unhandled_stopped`
62
+ member function, or
63
+ - when an object `scope` of type `std::execution::simple_counting_scope`
64
+ or `std::execution::counting_scope` is destroyed and `scope.state` is
65
+ not equal to *`joined`*, *`unused`*, or *`unused-and-closed`*
66
+ [[exec.simple.counting.ctor]], or
67
+ - when `std::execution::get_parallel_scheduler` is called and
68
+ `std::execution::system_context_replaceability::query_parallel_scheduler_backend()`
69
+ returns a null pointer value [[exec.par.scheduler]], or
70
+ - when an exception is thrown from a coroutine `std::execution::task`
71
+ [[exec.task]] which doesn’t support a
72
+ `std::execution::set_error_t(std::exception_ptr)` completion.
73
 
74
  — *end note*]
75
 
76
+ In the situation where no matching handler is found, it is
77
+ *implementation-defined* whether or not the stack is unwound before
78
+ `std::terminate` is invoked. In the situation where the search for a
79
+ handler [[except.handle]] exits the function body of a function with a
80
+ non-throwing exception specification [[except.spec]], it is
81
+ *implementation-defined* whether the stack is unwound, unwound
 
82
  partially, or not unwound at all before the function `std::terminate` is
83
  invoked. In all other situations, the stack shall not be unwound before
84
  the function `std::terminate` is invoked. An implementation is not
85
  permitted to finish stack unwinding prematurely based on a determination
86
  that the unwind process will eventually cause an invocation of the
87
  function `std::terminate`.
88
 
89
+ <!-- Link reference definitions -->
90
+ [algorithms.parallel.defns]: algorithms.md#algorithms.parallel.defns
91
+ [algorithms.parallel.exceptions]: algorithms.md#algorithms.parallel.exceptions
92
+ [basic.compound]: basic.md#basic.compound
93
+ [basic.contract.eval]: basic.md#basic.contract.eval
94
+ [basic.def.odr]: basic.md#basic.def.odr
95
+ [basic.start.dynamic]: basic.md#basic.start.dynamic
96
+ [basic.start.main]: basic.md#basic.start.main
97
+ [basic.start.term]: basic.md#basic.start.term
98
+ [basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
99
+ [basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
100
+ [basic.types.general]: basic.md#basic.types.general
101
+ [class.abstract]: class.md#class.abstract
102
+ [class.base.init]: class.md#class.base.init
103
+ [class.copy.ctor]: class.md#class.copy.ctor
104
+ [class.dtor]: class.md#class.dtor
105
+ [class.inhctor.init]: class.md#class.inhctor.init
106
+ [conv.fctptr]: expr.md#conv.fctptr
107
+ [conv.ptr]: expr.md#conv.ptr
108
+ [conv.qual]: expr.md#conv.qual
109
+ [dcl.fct]: dcl.md#dcl.fct
110
+ [dcl.init]: dcl.md#dcl.init
111
+ [dcl.init.aggr]: dcl.md#dcl.init.aggr
112
+ [dcl.init.general]: dcl.md#dcl.init.general
113
+ [except]: #except
114
+ [except.ctor]: #except.ctor
115
+ [except.handle]: #except.handle
116
+ [except.nested]: support.md#except.nested
117
+ [except.pre]: #except.pre
118
+ [except.spec]: #except.spec
119
+ [except.special]: #except.special
120
+ [except.special.general]: #except.special.general
121
+ [except.terminate]: #except.terminate
122
+ [except.throw]: #except.throw
123
+ [exception.terminate]: support.md#exception.terminate
124
+ [exec.par.scheduler]: exec.md#exec.par.scheduler
125
+ [exec.run.loop]: exec.md#exec.run.loop
126
+ [exec.simple.counting.ctor]: exec.md#exec.simple.counting.ctor
127
+ [exec.task]: exec.md#exec.task
128
+ [exec.with.awaitable.senders]: exec.md#exec.with.awaitable.senders
129
+ [execpol.par]: algorithms.md#execpol.par
130
+ [execpol.parunseq]: algorithms.md#execpol.parunseq
131
+ [execpol.seq]: algorithms.md#execpol.seq
132
+ [expr.call]: expr.md#expr.call
133
+ [expr.const]: expr.md#expr.const
134
+ [expr.dynamic.cast]: expr.md#expr.dynamic.cast
135
+ [expr.new]: expr.md#expr.new
136
+ [expr.prim.lambda.capture]: expr.md#expr.prim.lambda.capture
137
+ [expr.throw]: expr.md#expr.throw
138
+ [expr.typeid]: expr.md#expr.typeid
139
+ [futures]: thread.md#futures
140
+ [intro.execution]: basic.md#intro.execution
141
+ [intro.races]: basic.md#intro.races
142
+ [over.binary]: over.md#over.binary
143
+ [over.match]: over.md#over.match
144
+ [over.over]: over.md#over.over
145
+ [propagation]: support.md#propagation
146
+ [stmt.jump]: stmt.md#stmt.jump
147
+ [stmt.label]: stmt.md#stmt.label
148
+ [stmt.pre]: stmt.md#stmt.pre
149
+ [stmt.return]: stmt.md#stmt.return
150
+ [stopcallback.cons]: thread.md#stopcallback.cons
151
+ [stopcallback.inplace.cons]: thread.md#stopcallback.inplace.cons
152
+ [stopsource.inplace.mem]: thread.md#stopsource.inplace.mem
153
+ [stopsource.mem]: thread.md#stopsource.mem
154
+ [structure.specifications]: library.md#structure.specifications
155
+ [support.start.term]: support.md#support.start.term
156
+ [temp.explicit]: temp.md#temp.explicit
157
+ [term.odr.use]: basic.md#term.odr.use
158
+ [thread.condition.condvar]: thread.md#thread.condition.condvar
159
+ [thread.condition.condvarany]: thread.md#thread.condition.condvarany
160
+ [thread.thread.assign]: thread.md#thread.thread.assign
161
+ [thread.thread.constr]: thread.md#thread.thread.constr
162
+ [thread.thread.destr]: thread.md#thread.thread.destr
163
+ [uncaught.exceptions]: support.md#uncaught.exceptions