tmp/tmphwzuy23e/{from.md → to.md}
RENAMED
|
@@ -2,40 +2,44 @@
|
|
| 2 |
|
| 3 |
The result of a `typeid` expression is an lvalue of static type `const`
|
| 4 |
`std::type_info` [[type.info]] and dynamic type `const` `std::type_info`
|
| 5 |
or `const` *name* where *name* is an *implementation-defined* class
|
| 6 |
publicly derived from `std::type_info` which preserves the behavior
|
| 7 |
-
described in [[type.info]].[^15]
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
program is
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
When `typeid` is applied to a glvalue whose type is a polymorphic class
|
| 13 |
type [[class.virtual]], the result refers to a `std::type_info` object
|
| 14 |
representing the type of the most derived object [[intro.object]] (that
|
| 15 |
is, the dynamic type) to which the glvalue refers. If the glvalue is
|
| 16 |
-
obtained by applying the unary `*` operator to a pointer[^16]
|
| 17 |
-
|
|
|
|
| 18 |
expression throws an exception [[except.throw]] of a type that would
|
| 19 |
match a handler of type `std::bad_typeid` exception [[bad.typeid]].
|
| 20 |
|
| 21 |
When `typeid` is applied to an expression other than a glvalue of a
|
| 22 |
polymorphic class type, the result refers to a `std::type_info` object
|
| 23 |
representing the static type of the expression. Lvalue-to-rvalue
|
| 24 |
[[conv.lval]], array-to-pointer [[conv.array]], and function-to-pointer
|
| 25 |
[[conv.func]] conversions are not applied to the expression. If the
|
| 26 |
expression is a prvalue, the temporary materialization conversion
|
| 27 |
[[conv.rval]] is applied. The expression is an unevaluated operand
|
| 28 |
-
[[
|
| 29 |
|
| 30 |
When `typeid` is applied to a *type-id*, the result refers to a
|
| 31 |
`std::type_info` object representing the type of the *type-id*. If the
|
| 32 |
type of the *type-id* is a reference to a possibly cv-qualified type,
|
| 33 |
the result of the `typeid` expression refers to a `std::type_info`
|
| 34 |
-
object representing the cv-unqualified referenced type.
|
| 35 |
-
the *type-id* is a class type or a reference to a class type, the class
|
| 36 |
-
shall be completely-defined.
|
| 37 |
|
| 38 |
[*Note 1*: The *type-id* cannot denote a function type with a
|
| 39 |
*cv-qualifier-seq* or a *ref-qualifier* [[dcl.fct]]. — *end note*]
|
| 40 |
|
| 41 |
If the type of the expression or *type-id* is a cv-qualified type, the
|
|
@@ -55,11 +59,13 @@ typeid(D) == typeid(d2); // yields true
|
|
| 55 |
typeid(D) == typeid(const D&); // yields true
|
| 56 |
```
|
| 57 |
|
| 58 |
— *end example*]
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
| 62 |
|
| 63 |
[*Note 2*: Subclause [[class.cdtor]] describes the behavior of `typeid`
|
| 64 |
applied to an object under construction or destruction. — *end note*]
|
| 65 |
|
|
|
|
| 2 |
|
| 3 |
The result of a `typeid` expression is an lvalue of static type `const`
|
| 4 |
`std::type_info` [[type.info]] and dynamic type `const` `std::type_info`
|
| 5 |
or `const` *name* where *name* is an *implementation-defined* class
|
| 6 |
publicly derived from `std::type_info` which preserves the behavior
|
| 7 |
+
described in [[type.info]].[^15]
|
| 8 |
+
|
| 9 |
+
The lifetime of the object referred to by the lvalue extends to the end
|
| 10 |
+
of the program. Whether or not the destructor is called for the
|
| 11 |
+
`std::type_info` object at the end of the program is unspecified.
|
| 12 |
+
|
| 13 |
+
If the type of the *expression* or *type-id* operand is a (possibly
|
| 14 |
+
cv-qualified) class type or a reference to (possibly cv-qualified) class
|
| 15 |
+
type, that class shall be completely defined.
|
| 16 |
|
| 17 |
When `typeid` is applied to a glvalue whose type is a polymorphic class
|
| 18 |
type [[class.virtual]], the result refers to a `std::type_info` object
|
| 19 |
representing the type of the most derived object [[intro.object]] (that
|
| 20 |
is, the dynamic type) to which the glvalue refers. If the glvalue is
|
| 21 |
+
obtained by applying the unary `*` operator to a pointer[^16]
|
| 22 |
+
|
| 23 |
+
and the pointer is a null pointer value [[basic.compound]], the `typeid`
|
| 24 |
expression throws an exception [[except.throw]] of a type that would
|
| 25 |
match a handler of type `std::bad_typeid` exception [[bad.typeid]].
|
| 26 |
|
| 27 |
When `typeid` is applied to an expression other than a glvalue of a
|
| 28 |
polymorphic class type, the result refers to a `std::type_info` object
|
| 29 |
representing the static type of the expression. Lvalue-to-rvalue
|
| 30 |
[[conv.lval]], array-to-pointer [[conv.array]], and function-to-pointer
|
| 31 |
[[conv.func]] conversions are not applied to the expression. If the
|
| 32 |
expression is a prvalue, the temporary materialization conversion
|
| 33 |
[[conv.rval]] is applied. The expression is an unevaluated operand
|
| 34 |
+
[[term.unevaluated.operand]].
|
| 35 |
|
| 36 |
When `typeid` is applied to a *type-id*, the result refers to a
|
| 37 |
`std::type_info` object representing the type of the *type-id*. If the
|
| 38 |
type of the *type-id* is a reference to a possibly cv-qualified type,
|
| 39 |
the result of the `typeid` expression refers to a `std::type_info`
|
| 40 |
+
object representing the cv-unqualified referenced type.
|
|
|
|
|
|
|
| 41 |
|
| 42 |
[*Note 1*: The *type-id* cannot denote a function type with a
|
| 43 |
*cv-qualifier-seq* or a *ref-qualifier* [[dcl.fct]]. — *end note*]
|
| 44 |
|
| 45 |
If the type of the expression or *type-id* is a cv-qualified type, the
|
|
|
|
| 59 |
typeid(D) == typeid(const D&); // yields true
|
| 60 |
```
|
| 61 |
|
| 62 |
— *end example*]
|
| 63 |
|
| 64 |
+
The type `std::type_info` [[type.info]] is not predefined; if a standard
|
| 65 |
+
library declaration [[typeinfo.syn]], [[std.modules]] of
|
| 66 |
+
`std::type_info` does not precede [[basic.lookup.general]] a `typeid`
|
| 67 |
+
expression, the program is ill-formed.
|
| 68 |
|
| 69 |
[*Note 2*: Subclause [[class.cdtor]] describes the behavior of `typeid`
|
| 70 |
applied to an object under construction or destruction. — *end note*]
|
| 71 |
|