tmp/tmpc003t279/{from.md → to.md}
RENAMED
|
@@ -16,23 +16,23 @@ A *handler* is a match for an exception object of type `E` if
|
|
| 16 |
- The *handler* is of type cv `T` or cv `T&` and `E` and `T` are the
|
| 17 |
same type (ignoring the top-level *cv-qualifier*s), or
|
| 18 |
- the *handler* is of type cv `T` or cv `T&` and `T` is an unambiguous
|
| 19 |
public base class of `E`, or
|
| 20 |
- the *handler* is of type cv `T` or `const T&` where `T` is a pointer
|
| 21 |
-
or pointer
|
| 22 |
type that can be converted to `T` by one or more of
|
| 23 |
-
- a standard pointer conversion
|
| 24 |
-
|
| 25 |
-
- a function pointer conversion
|
| 26 |
-
- a qualification conversion
|
| 27 |
- the *handler* is of type cv `T` or `const T&` where `T` is a pointer
|
| 28 |
-
or pointer
|
| 29 |
|
| 30 |
[*Note 1*: A *throw-expression* whose operand is an integer literal
|
| 31 |
-
with value zero does not match a handler of pointer or pointer
|
| 32 |
type. A handler of reference to array or function type is never a match
|
| 33 |
-
for any exception object
|
| 34 |
|
| 35 |
[*Example 1*:
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
class Matherr { ... virtual void vf(); };
|
|
@@ -72,44 +72,44 @@ try block.
|
|
| 72 |
|
| 73 |
If no match is found among the handlers for a try block, the search for
|
| 74 |
a matching handler continues in a dynamically surrounding try block of
|
| 75 |
the same thread.
|
| 76 |
|
| 77 |
-
A handler is considered active when initialization is complete for the
|
| 78 |
parameter (if any) of the catch clause.
|
| 79 |
|
| 80 |
[*Note 3*: The stack will have been unwound at that
|
| 81 |
point. — *end note*]
|
| 82 |
|
| 83 |
-
Also, an implicit handler is considered active when
|
| 84 |
-
is entered due to a throw. A handler is no longer
|
| 85 |
-
the catch clause exits.
|
| 86 |
|
| 87 |
The exception with the most recently activated handler that is still
|
| 88 |
active is called the *currently handled exception*.
|
| 89 |
|
| 90 |
-
If no matching handler is found, the function `std::terminate
|
| 91 |
called; whether or not the stack is unwound before this call to
|
| 92 |
-
`std::terminate
|
| 93 |
|
| 94 |
Referring to any non-static member or base class of an object in the
|
| 95 |
handler for a *function-try-block* of a constructor or destructor for
|
| 96 |
that object results in undefined behavior.
|
| 97 |
|
| 98 |
The scope and lifetime of the parameters of a function or constructor
|
| 99 |
extend into the handlers of a *function-try-block*.
|
| 100 |
|
| 101 |
Exceptions thrown in destructors of objects with static storage duration
|
| 102 |
or in constructors of namespace-scope objects with static storage
|
| 103 |
-
duration are not caught by a *function-try-block* on the `main`
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
|
| 109 |
-
If a return statement appears in a handler of the
|
| 110 |
-
of a constructor, the program is ill-formed.
|
| 111 |
|
| 112 |
The currently handled exception is rethrown if control reaches the end
|
| 113 |
of a handler of the *function-try-block* of a constructor or destructor.
|
| 114 |
Otherwise, flowing off the end of the *compound-statement* of a
|
| 115 |
*handler* of a *function-try-block* is equivalent to flowing off the end
|
|
@@ -117,18 +117,19 @@ of the *compound-statement* of that function (see [[stmt.return]]).
|
|
| 117 |
|
| 118 |
The variable declared by the *exception-declaration*, of type cv `T` or
|
| 119 |
cv `T&`, is initialized from the exception object, of type `E`, as
|
| 120 |
follows:
|
| 121 |
|
| 122 |
-
- if `T` is a base class of `E`, the variable is copy-initialized
|
| 123 |
-
[[dcl.init]]
|
| 124 |
exception object;
|
| 125 |
-
- otherwise, the variable is copy-initialized
|
| 126 |
exception object.
|
| 127 |
|
| 128 |
The lifetime of the variable ends when the handler exits, after the
|
| 129 |
-
destruction of any
|
|
|
|
| 130 |
|
| 131 |
When the handler declares an object, any changes to that object will not
|
| 132 |
affect the exception object. When the handler declares a reference to an
|
| 133 |
object, any changes to the referenced object are changes to the
|
| 134 |
exception object and will have effect should that object be rethrown.
|
|
|
|
| 16 |
- The *handler* is of type cv `T` or cv `T&` and `E` and `T` are the
|
| 17 |
same type (ignoring the top-level *cv-qualifier*s), or
|
| 18 |
- the *handler* is of type cv `T` or cv `T&` and `T` is an unambiguous
|
| 19 |
public base class of `E`, or
|
| 20 |
- the *handler* is of type cv `T` or `const T&` where `T` is a pointer
|
| 21 |
+
or pointer-to-member type and `E` is a pointer or pointer-to-member
|
| 22 |
type that can be converted to `T` by one or more of
|
| 23 |
+
- a standard pointer conversion [[conv.ptr]] not involving conversions
|
| 24 |
+
to pointers to private or protected or ambiguous classes
|
| 25 |
+
- a function pointer conversion [[conv.fctptr]]
|
| 26 |
+
- a qualification conversion [[conv.qual]], 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 |
[*Note 1*: A *throw-expression* whose operand is an integer literal
|
| 31 |
+
with value zero does not match a handler of pointer or pointer-to-member
|
| 32 |
type. A handler of reference to array or function type is never a match
|
| 33 |
+
for any exception object [[expr.throw]]. — *end note*]
|
| 34 |
|
| 35 |
[*Example 1*:
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
class Matherr { ... virtual void vf(); };
|
|
|
|
| 72 |
|
| 73 |
If no match is found among the handlers for a try block, the search for
|
| 74 |
a matching handler continues in a dynamically surrounding try block of
|
| 75 |
the same thread.
|
| 76 |
|
| 77 |
+
A handler is considered *active* when initialization is complete for the
|
| 78 |
parameter (if any) of the catch clause.
|
| 79 |
|
| 80 |
[*Note 3*: The stack will have been unwound at that
|
| 81 |
point. — *end note*]
|
| 82 |
|
| 83 |
+
Also, an implicit handler is considered active when the function
|
| 84 |
+
`std::terminate` is entered due to a throw. A handler is no longer
|
| 85 |
+
considered active when the catch clause exits.
|
| 86 |
|
| 87 |
The exception with the most recently activated handler that is still
|
| 88 |
active is called the *currently handled exception*.
|
| 89 |
|
| 90 |
+
If no matching handler is found, the function `std::terminate` is
|
| 91 |
called; whether or not the stack is unwound before this call to
|
| 92 |
+
`std::terminate` is *implementation-defined* [[except.terminate]].
|
| 93 |
|
| 94 |
Referring to any non-static member or base class of an object in the
|
| 95 |
handler for a *function-try-block* of a constructor or destructor for
|
| 96 |
that object results in undefined behavior.
|
| 97 |
|
| 98 |
The scope and lifetime of the parameters of a function or constructor
|
| 99 |
extend into the handlers of a *function-try-block*.
|
| 100 |
|
| 101 |
Exceptions thrown in destructors of objects with static storage duration
|
| 102 |
or in constructors of namespace-scope objects with static storage
|
| 103 |
+
duration are not caught by a *function-try-block* on the `main` function
|
| 104 |
+
[[basic.start.main]]. Exceptions thrown in destructors of objects with
|
| 105 |
+
thread storage duration or in constructors of namespace-scope objects
|
| 106 |
+
with thread storage duration are not caught by a *function-try-block* on
|
| 107 |
+
the initial function of the thread.
|
| 108 |
|
| 109 |
+
If a `return` statement [[stmt.return]] appears in a handler of the
|
| 110 |
+
*function-try-block* of a constructor, the program is ill-formed.
|
| 111 |
|
| 112 |
The currently handled exception is rethrown if control reaches the end
|
| 113 |
of a handler of the *function-try-block* of a constructor or destructor.
|
| 114 |
Otherwise, flowing off the end of the *compound-statement* of a
|
| 115 |
*handler* of a *function-try-block* is equivalent to flowing off the end
|
|
|
|
| 117 |
|
| 118 |
The variable declared by the *exception-declaration*, of type cv `T` or
|
| 119 |
cv `T&`, is initialized from the exception object, of type `E`, as
|
| 120 |
follows:
|
| 121 |
|
| 122 |
+
- if `T` is a base class of `E`, the variable is copy-initialized
|
| 123 |
+
[[dcl.init]] from the corresponding base class subobject of the
|
| 124 |
exception object;
|
| 125 |
+
- otherwise, the variable is copy-initialized [[dcl.init]] from the
|
| 126 |
exception object.
|
| 127 |
|
| 128 |
The lifetime of the variable ends when the handler exits, after the
|
| 129 |
+
destruction of any objects with automatic storage duration initialized
|
| 130 |
+
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.
|