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 *
|
| 22 |
-
|
| 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
|
| 28 |
-
`std::nullptr_t`.
|
| 29 |
|
| 30 |
-
A *throw-expression* whose operand is an
|
| 31 |
-
|
| 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 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 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 |
-
|
| 122 |
-
|
| 123 |
-
|
| 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 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|