Created on 2014-07-14.00:00:00 last changed 121 months ago
Rationale (November, 2014):
Because the result of two separate evaluations of the typeid operator are not guaranteed to produce the same result, the comparison in the example is not permitted in a constant expression.
There is implementation divergence on the handling of typeid in constant expressions, for example:
static_assert(&typeid(int) == &typeid(int), ""); // #1
According to the current wording, it is unspecified whether two evaluations of the typeid operator produce the same result, even though typeid can be used in constant expressions as long as its operand is not a glvalue of a polymorphic class type. Of particular concern is the case where typeid might be evaluated in different translation units.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-11-24 00:00:00 | admin | set | messages: + msg5272 |
2014-07-14 00:00:00 | admin | create |