Created on 2009-05-08.00:00:00 last changed 178 months ago
[Voted into WP at March, 2010 meeting.]
Proposed resolution (February, 2010):
Change 7.6.1.11 [expr.const.cast] paragraph 4 as follows:
An lvalue of type T1 can be explicitly converted to an lvalue of type T2 using the cast const_cast<T2&> (where T1 and T2 are object types) if a pointer to T1 can be explicitly converted to the type “pointer to T2” using a const_cast. Similarly, for two object types T1 and T2, anexpressionlvalue of type T1 or, if T1 is a class type, an expression of type T1, can be explicitly converted to an rvalue of type T2 using the cast const_cast<T2&&> if a pointer to T1 can be explicitly converted to the type “pointer to T2” using a const_cast. The result of a reference const_cast refers to the original object.
Notes from the July, 2009 meeting:
The coresponding cast to an lvalue reference to const is ill-formed: in such cases, the operand must be an lvalue. The consensus of the CWG was that a cast to an rvalue reference should only accept an rvalue that is an rvalue reference (i.e., an object).
7.6.1.11 [expr.const.cast] paragraph 4 says,
...Similarly, for two effective object types T1 and T2, an expression of type T1 can be explicitly converted to an rvalue of type T2 using the cast const_cast<T2&&> if a pointer to T1 can be explicitly converted to the type “pointer to T2” using a const_cast. The result of a reference const_cast refers to the original object.
However, in some rvalue-reference const_casts there is no “original object,” e.g.,
const_cast<int&&>(2)
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | messages: + msg2677 |
2010-03-29 00:00:00 | admin | set | status: tentatively ready -> cd2 |
2010-02-16 00:00:00 | admin | set | messages: + msg2496 |
2010-02-16 00:00:00 | admin | set | status: drafting -> tentatively ready |
2009-11-08 00:00:00 | admin | set | status: open -> drafting |
2009-08-03 00:00:00 | admin | set | messages: + msg2216 |
2009-05-08 00:00:00 | admin | create |