From Jason Turner

[expr.typeid]

Diff to HTML by rtfpessoa

tmp/tmpco_a43fl/{from.md → to.md} RENAMED
@@ -2,22 +2,23 @@
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`
5
  `std::type_info` or `const` *name* where *name* is an
6
  *implementation-defined* class publicly derived from `std :: type_info`
7
- which preserves the behavior described in  [[type.info]].[^10] The
8
  lifetime of the object referred to by the lvalue extends to the end of
9
  the program. Whether or not the destructor is called for the
10
  `std::type_info` object at the end of the program is unspecified.
11
 
12
  When `typeid` is applied to a glvalue expression whose type is a
13
  polymorphic class type ([[class.virtual]]), the result refers to a
14
  `std::type_info` object representing the type of the most derived
15
  object ([[intro.object]]) (that is, the dynamic type) to which the
16
  glvalue refers. If the glvalue expression is obtained by applying the
17
- unary `*` operator to a pointer[^11] and the pointer is a null pointer
18
- value ([[conv.ptr]]), the `typeid` expression throws the
 
19
  `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 (
@@ -33,12 +34,13 @@ 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. If the type of
35
  the *type-id* is a class type or a reference to a class type, the class
36
  shall be completely-defined.
37
 
38
- The top-level cv-qualifiers of the glvalue expression or the *type-id*
39
- that is the operand of `typeid` are always ignored.
 
40
 
41
  ``` cpp
42
  class D { /* ... */ };
43
  D d1;
44
  const D d2;
 
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`
5
  `std::type_info` or `const` *name* where *name* is an
6
  *implementation-defined* class publicly derived from `std :: type_info`
7
+ which preserves the behavior described in  [[type.info]].[^9] The
8
  lifetime of the object referred to by the lvalue extends to the end of
9
  the program. Whether or not the destructor is called for the
10
  `std::type_info` object at the end of the program is unspecified.
11
 
12
  When `typeid` is applied to a glvalue expression whose type is a
13
  polymorphic class type ([[class.virtual]]), the result refers to a
14
  `std::type_info` object representing the type of the most derived
15
  object ([[intro.object]]) (that is, the dynamic type) to which the
16
  glvalue refers. If the glvalue expression is obtained by applying the
17
+ unary `*` operator to a pointer[^10] and the pointer is a null pointer
18
+ value ([[conv.ptr]]), the `typeid` expression throws an exception (
19
+ [[except.throw]]) of a type that would match a handler of type
20
  `std::bad_typeid` exception ([[bad.typeid]]).
21
 
22
  When `typeid` is applied to an expression other than a glvalue of a
23
  polymorphic class type, the result refers to a `std::type_info` object
24
  representing the static type of the expression. Lvalue-to-rvalue (
 
34
  the result of the `typeid` expression refers to a `std::type_info`
35
  object representing the *cv*-unqualified referenced type. If the type of
36
  the *type-id* is a class type or a reference to a class type, the class
37
  shall be completely-defined.
38
 
39
+ If the type of the expression or *type-id* is a cv-qualified type, the
40
+ result of the `typeid` expression refers to a `std::type_info` object
41
+ representing the cv-unqualified type.
42
 
43
  ``` cpp
44
  class D { /* ... */ };
45
  D d1;
46
  const D d2;