From Jason Turner

[except.handle]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpd066218m/{from.md → to.md} +29 -29
tmp/tmpd066218m/{from.md → to.md} RENAMED
@@ -16,22 +16,21 @@ A *handler* is a match for an exception object of type `E` if
16
 
17
  - The *handler* is of type *cv* `T` or *cv* `T&` and `E` and `T` are the
18
  same type (ignoring the top-level *cv-qualifiers*), or
19
  - the *handler* is of type *cv* `T` or *cv* `T&` and `T` is an
20
  unambiguous public base class of `E`, or
21
- - the *handler* is of type *cv1* `T*` *cv2* and `E` is a pointer type
22
- that can be converted to the type of the *handler* by either or both
23
- of
24
  - a standard pointer conversion ([[conv.ptr]]) not involving
25
  conversions to pointers to private or protected or ambiguous classes
26
- - a qualification conversion
27
- - the *handler* is a pointer or pointer to member type and `E` is
28
- `std::nullptr_t`.
29
 
30
- A *throw-expression* whose operand is an integral constant expression of
31
- integer type that evaluates to zero does not match a handler of pointer
32
- or pointer to member type.
33
 
34
  ``` cpp
35
  class Matherr { /* ... */ virtual void vf(); };
36
  class Overflow: public Matherr { /* ... */ };
37
  class Underflow: public Matherr { /* ... */ };
@@ -66,16 +65,15 @@ try block.
66
  If no match is found among the handlers for a try block, the search for
67
  a matching handler continues in a dynamically surrounding try block of
68
  the same thread.
69
 
70
  A handler is considered active when initialization is complete for the
71
- formal parameter (if any) of the catch clause. The stack will have been
72
- unwound at that point. Also, an implicit handler is considered active
73
- when `std::terminate()` or `std::unexpected()` is entered due to a
74
- throw. A handler is no longer considered active when the catch clause
75
- exits or when `std::unexpected()` exits after being entered due to a
76
- throw.
77
 
78
  The exception with the most recently activated handler that is still
79
  active is called the *currently handled exception*.
80
 
81
  If no matching handler is found, the function `std::terminate()` is
@@ -116,21 +114,23 @@ Otherwise, a function returns when control reaches the end of a handler
116
  for the *function-try-block* ([[stmt.return]]). Flowing off the end of
117
  a *function-try-block* is equivalent to a `return` with no value; this
118
  results in undefined behavior in a value-returning function (
119
  [[stmt.return]]).
120
 
121
- If the *exception-declaration* specifies a name, it declares a variable
122
- which is copy-initialized ([[dcl.init]]) from the exception object. If
123
- the *exception-declaration* denotes an object type but does not specify
124
- a name, a temporary ([[class.temporary]]) is copy-initialized (
125
- [[dcl.init]]) from the exception object. The lifetime of the variable or
126
- temporary ends when the handler exits, after the destruction of any
127
- automatic objects initialized within the handler.
128
 
129
- When the handler declares a non-constant object, any changes to that
130
- object will not affect the temporary object that was initialized by
131
- execution of the *throw-expression*. When the handler declares a
132
- reference to a non-constant object, any changes to the referenced object
133
- are changes to the temporary object initialized when the
134
- *throw-expression* was executed and will have effect should that object
135
- be rethrown.
 
 
 
 
 
 
136
 
 
16
 
17
  - The *handler* is of type *cv* `T` or *cv* `T&` and `E` and `T` are the
18
  same type (ignoring the top-level *cv-qualifiers*), or
19
  - the *handler* is of type *cv* `T` or *cv* `T&` and `T` is an
20
  unambiguous public base class of `E`, or
21
+ - the *handler* is of type *cv* `T` or `const T&` where `T` is a pointer
22
+ type and `E` is a pointer type that can be converted to `T` by either
23
+ or both of
24
  - a standard pointer conversion ([[conv.ptr]]) not involving
25
  conversions to pointers to private or protected or ambiguous classes
26
+ - a qualification conversion, or
27
+ - the *handler* is of type *cv* `T` or `const T&` where `T` is a pointer
28
+ or pointer to member type and `E` is `std::nullptr_t`.
29
 
30
+ A *throw-expression* whose operand is an integer literal with value zero
31
+ does not match a handler of pointer or pointer to member type.
 
32
 
33
  ``` cpp
34
  class Matherr { /* ... */ virtual void vf(); };
35
  class Overflow: public Matherr { /* ... */ };
36
  class Underflow: public Matherr { /* ... */ };
 
65
  If no match is found among the handlers for a try block, the search for
66
  a matching handler continues in a dynamically surrounding try block of
67
  the same thread.
68
 
69
  A handler is considered active when initialization is complete for the
70
+ parameter (if any) of the catch clause. The stack will have been unwound
71
+ at that point. Also, an implicit handler is considered active when
72
+ `std::terminate()` or `std::unexpected()` is entered due to a throw. A
73
+ handler is no longer considered active when the catch clause exits or
74
+ when `std::unexpected()` exits after being entered due to a throw.
 
75
 
76
  The exception with the most recently activated handler that is still
77
  active is called the *currently handled exception*.
78
 
79
  If no matching handler is found, the function `std::terminate()` is
 
114
  for the *function-try-block* ([[stmt.return]]). Flowing off the end of
115
  a *function-try-block* is equivalent to a `return` with no value; this
116
  results in undefined behavior in a value-returning function (
117
  [[stmt.return]]).
118
 
119
+ The variable declared by the *exception-declaration*, of type cv `T` or
120
+ cv `T&`, is initialized from the exception object, of type `E`, as
121
+ follows:
 
 
 
 
122
 
123
+ - if `T` is a base class of `E`, the variable is copy-initialized (
124
+ [[dcl.init]]) from the corresponding base class subobject of the
125
+ exception object;
126
+ - otherwise, the variable is copy-initialized ([[dcl.init]]) from the
127
+ exception object.
128
+
129
+ The lifetime of the variable ends when the handler exits, after the
130
+ destruction of any automatic objects initialized within the handler.
131
+
132
+ When the handler declares an object, any changes to that object will not
133
+ affect the exception object. When the handler declares a reference to an
134
+ object, any changes to the referenced object are changes to the
135
+ exception object and will have effect should that object be rethrown.
136