Title
typeid expressions in constant expressions
Status
nad
Section
7.7 [expr.const]
Submitter
UK

Created on 2009-03-03.00:00:00 last changed 186 months ago

Messages

Date: 2009-07-15.00:00:00

Rationale (July, 2009):

The intent of this specification was that the address of such a typeinfo object could be treated as an address constant and thus usable in constant initialization (contrary to the statement in the comment, the result of typeid is an lvalue, not a reference).

Date: 2022-11-20.07:54:16
N2800 comment UKĀ 51

typeid expressions can never be constant, whether or not the operand is a polymorphic class type. The result of the expression is a reference, and the typeinfo class that the reference refers to is polymorphic, with a virtual destructor - it can never be a literal type.

History
Date User Action Args
2009-08-03 00:00:00adminsetstatus: open -> nad
2009-03-23 00:00:00adminsetmessages: + msg1985
2009-03-03 00:00:00admincreate