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

2024-10-26


1269. dynamic_cast of an xvalue operand

Section: 7.6.1.7  [expr.dynamic.cast]     Status: CD3     Submitter: Michael Wong     Date: 2011-03-21

[Moved to DR at the October, 2012 meeting.]

7.6.1.7 [expr.dynamic.cast] paragraph 2 allows an expression of any value category when the target type is an rvalue reference. However, paragraph 6 requires that the operand be an lvalue if the runtime check is to be applied. This requirement should presumably be relaxed to require only a glvalue when the target type is an rvalue reference.

Proposed resolution (August, 2011):

Change 7.6.1.7 [expr.dynamic.cast] paragraph 6 as follows:

Otherwise, v shall be a pointer to or an lvalue a glvalue of a polymorphic type (11.7.3 [class.virtual]).

Additional note, January, 2012:

An objection has been raised to the proposed resolution on the basis that it unnecessarily weakens the distinction between rvalues and lvalues, making it easier to create dangling references. Its status has therefore been changed back to "review" to allow further discussion.