typeid in core constant expressions
7.7 [expr.const]
Richard Smith

Created on 2012-08-10.00:00:00 last changed 90 months ago


Date: 2013-04-15.00:00:00

[Moved to DR at the April, 2013 meeting.]

Date: 2012-10-15.00:00:00

Proposed resolution (October, 2012):

Change 7.7 [expr.const] paragraph 2 as follows:

  • ...

  • a typeid expression ( [expr.typeid]) whose operand is a glvalue of a polymorphic class type;

Date: 2012-08-10.00:00:00

One of the criteria in 7.7 [expr.const] paragraph 2 for disqualifying an expression from being a constant expression is:

  • a typeid expression ( [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.

Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: + msg4394
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-11-03 00:00:00adminsetmessages: + msg4056
2012-11-03 00:00:00adminsetstatus: open -> ready
2012-08-10 00:00:00admincreate