Created on 2011-08-30.00:00:00 last changed 34 months ago
[Moved to DR at the October, 2012 meeting.]
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.
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]
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]
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?
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-02-18 07:47:23 | admin | set | messages: + msg6704 |
2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
2013-05-03 00:00:00 | admin | set | status: dr -> drwp |
2012-11-03 00:00:00 | admin | set | messages: + msg4126 |
2012-11-03 00:00:00 | admin | set | status: ready -> dr |
2012-02-27 00:00:00 | admin | set | messages: + msg3696 |
2012-02-27 00:00:00 | admin | set | messages: + msg3695 |
2012-02-27 00:00:00 | admin | set | status: open -> ready |
2011-08-30 00:00:00 | admin | create |