CWG Issue 1535 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
1535.typeid in core constant expressions
Section: 7.7 [expr.const]Status: CD3Submitter: Richard SmithDate: 2012-08-10
[Moved to DR at the April, 2013 meeting.]
One of the criteria in 7.7 [expr.const] paragraph 2 for disqualifying an expression from being a constant expression is:
a typeid expression (7.6.1.8 [expr.typeid]) whose operand is of a polymorphic class type;
on the basis that a runtime test for the dynamic type is inconsistent with a constant expression. However, it is only glvalues of polymorphic type that require a runtime test; _type-id_s and prvalues with a polymorphic type could (and should) be permitted in constant expressions.
Proposed resolution (October, 2012):
Change 7.7 [expr.const] paragraph 2 as follows:
- ...
- a typeid expression (7.6.1.8 [expr.typeid]) whose operand is a glvalue of a polymorphic class type;