◐ Shell
clean mode source ↗

CWG Issue 1535

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 120a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2026-05-31


1535. typeid in core constant expressions

Section: 7.7  [expr.const]     Status: CD3     Submitter: Richard Smith     Date: 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-ids 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;