Created on 2021-08-19.00:00:00 last changed 35 months ago
Rationale (December, 2021):
The change was already applied via the editorial review process, with approval from CWG at the 2021-08-24 teleconference.
According to 7.6.1.8 [expr.typeid] paragraphs 2-3,
When typeid is applied to a glvalue whose type is a polymorphic class type (11.7.3 [class.virtual]), the result refers to a std::type_info object representing the type of the most derived object (6.7.2 [intro.object]) (that is, the dynamic type) to which the glvalue refers...
When typeid is applied to an expression other than a glvalue of a polymorphic class type, the result refers to a std::type_info object representing the static type of the expression.
The status of a glvalue of incomplete class type is not clear from this specification. Since it is not known whether an incomplete class type is polymorphic or not, the existing wording could be read either as giving that case undefined behavior or as falling into paragraph 3 and always returning the static type.
The wording for dynamic_cast requires class types to be complete, as does paragraph 4, describing typeid applied to a type-id.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-01-06 00:00:00 | admin | set | messages: + msg6622 |
2021-08-19 00:00:00 | admin | create |