From Jason Turner

[except.special]

Diff to HTML by rtfpessoa

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