From Jason Turner

[except.throw]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_yf3uzkf/{from.md → to.md} +6 -11
tmp/tmp_yf3uzkf/{from.md → to.md} RENAMED
@@ -56,14 +56,12 @@ When an exception is thrown, control is transferred to the nearest
56
  handler with a matching type [[except.handle]]; “nearest” means the
57
  handler for which the *compound-statement* or *ctor-initializer*
58
  following the `try` keyword was most recently entered by the thread of
59
  control and not yet exited.
60
 
61
- Throwing an exception copy-initializes ([[dcl.init]],
62
- [[class.copy.ctor]]) a temporary object, called the *exception object*.
63
- An lvalue denoting the temporary is used to initialize the variable
64
- declared in the matching *handler* [[except.handle]]. If the type of the
65
  exception object would be an incomplete type, an abstract class type
66
  [[class.abstract]], or a pointer to an incomplete type other than
67
  cv `void` the program is ill-formed.
68
 
69
  The memory for the exception object is allocated in an unspecified way,
@@ -106,11 +104,12 @@ becomes active [[except.handle]].
106
  [*Note 4*: An exception can have active handlers and still be
107
  considered uncaught if it is rethrown. — *end note*]
108
 
109
  If the exception handling mechanism handling an uncaught exception
110
  [[except.uncaught]] directly invokes a function that exits via an
111
- exception, the function `std::terminate` is called [[except.terminate]].
 
112
 
113
  [*Example 2*:
114
 
115
  ``` cpp
116
  struct C {
@@ -130,12 +129,8 @@ int main() {
130
  }
131
  ```
132
 
133
  — *end example*]
134
 
135
- [*Note 5*:
136
-
137
- Consequently, destructors should generally catch exceptions and not let
138
- them propagate.
139
-
140
- — *end note*]
141
 
 
56
  handler with a matching type [[except.handle]]; “nearest” means the
57
  handler for which the *compound-statement* or *ctor-initializer*
58
  following the `try` keyword was most recently entered by the thread of
59
  control and not yet exited.
60
 
61
+ Throwing an exception copy-initializes [[dcl.init]], [[class.copy.ctor]]
62
+ a temporary object, called the *exception object*. If the type of the
 
 
63
  exception object would be an incomplete type, an abstract class type
64
  [[class.abstract]], or a pointer to an incomplete type other than
65
  cv `void` the program is ill-formed.
66
 
67
  The memory for the exception object is allocated in an unspecified way,
 
104
  [*Note 4*: An exception can have active handlers and still be
105
  considered uncaught if it is rethrown. — *end note*]
106
 
107
  If the exception handling mechanism handling an uncaught exception
108
  [[except.uncaught]] directly invokes a function that exits via an
109
+ exception, the function `std::terminate` is invoked
110
+ [[except.terminate]].
111
 
112
  [*Example 2*:
113
 
114
  ``` cpp
115
  struct C {
 
129
  }
130
  ```
131
 
132
  — *end example*]
133
 
134
+ [*Note 5*: If a destructor directly invoked by stack unwinding exits
135
+ via an exception, `std::terminate` is invoked. — *end note*]
 
 
 
 
136