This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-06
[Moved to DR at the October, 2012 meeting.]
There are some points in the description discarded-value expressions that need clarification:
Does this require the lvalue-to-rvalue conversion in the listed cases or only prohibit it in all other cases (“only if” vs “if and only if”)?
Does this apply only to built-in operations or to overloaded operators?
Does this apply to non-POD types?
Suggested resolution:
In some contexts, an expression only appears for its side effects. Such an expression is called a discarded-value expression. The expression is evaluated and its value is discarded. The array-to-pointer (7.3.3 [conv.array]) and function-to-pointer (7.3.4 [conv.func]) standard conversions are not applied. The lvalue-to-rvalue conversion (7.3.2 [conv.lval]) is applied if and only if the expression is an lvalue of volatile-qualified type and it has one of the following forms:
id-expression (_N4567_.5.1.1 [expr.prim.general]),
subscriptingsubscript operation (7.6.1.2 [expr.sub]),class member access (7.6.1.5 [expr.ref]),
indirection operation (7.6.2.2 [expr.unary.op]),
pointer-to-member operation (7.6.4 [expr.mptr.oper]),
conditional
expressionoperation (7.6.16 [expr.cond]) where both the second and the third operands are one ofthe abovethese forms, orcomma
expressionoperation (7.6.20 [expr.comma]) where the right operand is one ofthe abovethese forms.[Note: Expressions invoking user-defined operators are not the operations above. Discarded-value expressions apply to class types, which will be ill-formed if there is no volatile copy constructor with which to initialize the temporary. —end note]
Proposed resolution (February, 2012):
Change Clause 7 [expr] paragraph 10 as follows:
...The lvalue-to-rvalue conversion (7.3.2 [conv.lval]) is applied if and only if the expression is an lvalue of volatile-qualified type and it
hasis one of the followingforms:
( expression ), where expression is one of these expressions,
id-expression (_N4567_.5.1.1 [expr.prim.general]),
...
conditional expression (7.6.16 [expr.cond]) where both the second and the third operands are one of
the abovethese expressions, orcomma expression (7.6.20 [expr.comma]) where the right operand is one of
the abovethese expressions.[Note: Using an overloaded operator causes a function call; the above covers only operators with built-in meaning. If the lvalue is of class type, it must have a volatile copy constructor to initialize the temporary that is the result of the lvalue-to-rvalue conversion. —end note]
Additional note (February, 2012):
A problem was discovered that was not addressed by the proposed resolution that was reviewed at the February, 2012 meeting, so the issue has been moved back to "review" status with revised wording.