Created on 2013-03-15.00:00:00 last changed 11 months ago
Proposed resolution (approved by CWG 2023-04-28):
Change in 7.2.1 [basic.lval] paragraph 6 as follows:
Whenever a glvalue appears as an operand of an operator thatexpectsrequires a prvalue for that operand, the lvalue-to-rvalue (7.3.2 [conv.lval]), array-to-pointer (7.3.3 [conv.array]), or function-to-pointer (7.3.4 [conv.func]) standard conversions are applied to convert the expression to a prvalue. ...
Change in 7.3.1 [conv.general] paragraph 1 as follows:
... A standard conversion sequence will be applied to an expression if necessary to convert it to an expression having a required destination type and value category. ...
Add to the bulleted list in 7.4 [expr.arith.conv] paragraph 1 as follows:
... This pattern is called the usual arithmetic conversions, which are defined as follows:
- The lvalue-to-rvalue conversion (7.3.2 [conv.lval]) is applied to each operand and the resulting prvalues are used in place of the original operands for the remainder of this section.
- If either operand is of scoped enumeration type (9.7.1 [dcl.enum]), no conversions are performed; if the other operand does not have the same type, the expression is ill-formed.
- ...
Change in 7.6.1.3 [expr.call] paragraph 1 as follows:
... For a call to a non-member function or to a static member function, the postfix expression shall be eitherbean lvalue that refers to a function (in which case the function-to-pointer standard conversion (7.3.4 [conv.func]) is suppressed on the postfix expression), orhavea prvalue of function pointer type.
Change in 7.6.2.2 [expr.unary.op] paragraph 7 as follows:
The operand of the unary + operator shallhavebe a prvalue of arithmetic, unscoped enumeration, or pointer type and the result is the value of the argument. Integral promotion is performed on integral or enumeration operands. ...
Change in 7.6.2.2 [expr.unary.op] paragraph 8 as follows:
The operand of the unary - operator shallhavebe a prvalue of arithmetic or unscoped enumeration type and the result is the negative of its operand. Integral promotion is performed on integral or enumeration operands. ...
Change in 7.6.2.2 [expr.unary.op] paragraph 10 as follows:
The operand of the ~ operator shallhavebe a prvalue of integral or unscoped enumeration type. Integral promotions are performed. ...
Change in 7.6.2.9 [expr.delete] paragraph 1 as follows:
...The operand shall be of pointer to object type or of class type.If the operand is of class type,the operandit is contextually implicitly converted (7.3 [conv]) to a pointer to object type. [ Footnote: ... ] Otherwise, it shall be a prvalue of pointer to object type. The delete-expression has type void.
Change in 7.6.4 [expr.mptr.oper] paragraph 2 and 3 as follows:
The binary operator .* binds its second operand, which shall be a prvalue of type “pointer to member of T” to its first operand, which shall be ...
The binary operator ->* binds its second operand, which shall be a prvalue of type “pointer to member of T” to its first operand, which shall be ...
Change in 7.6.6 [expr.add] paragraph 1 as follows:
The additive operators + and - group left-to-right.TheEach operand shall be a prvalue. If both operands have arithmetic or unscoped enumeration type, the usual arithmetic conversions (7.4 [expr.arith.conv]) are performedfor operands of arithmetic or enumeration type. Otherwise, if one operand has arithmetic or unscoped enumeration type, integral promotion is applied (7.3.7 [conv.prom]) to that operand. A converted or promoted operand is used in place of the corresponding original operand for the remainder of this section. ... For addition, either both operands shall have arithmeticor unscoped enumerationtype, or one operand shall be a pointer to a completely-defined object type and the other shall have integralor unscoped enumerationtype.
Change in 7.6.6 [expr.add] paragraph 2 as follows:
For subtraction, one of the following shall hold:
- both operands have arithmetic
or unscoped enumerationtype; or- both operands are pointers to cv-qualified or cv-unqualified versions of the same completely-defined object type; or
- the left operand is a pointer to a completely-defined object type and the right operand has integral
or unscoped enumerationtype.
Change in 7.6.7 [expr.shift] paragraph 1 as follows:
... The operands shall be prvalues of integral or unscoped enumeration type and integral promotions are performed. ...
Change in 9.4.1 [dcl.init.general] bullet 16.9 as follows:
- ...
- Otherwise, the initial value of the object being initialized is the (possibly converted) value of the initializer expression. A standard conversion sequence (7.3 [conv])
will beis used, if necessary,to convert the initializer expression to a prvalue of the cv-unqualified version of the destination type; no user-defined conversions are considered. ...- ...
[Accepted as a DR at the June, 2023 meeting.]
Although the note in 7.2.1 [basic.lval] paragraph 1 states that
The discussion of each built-in operator in Clause 7 [expr] indicates the category of the value it yields and the value categories of the operands it expects
in fact, many of the operators that take prvalue operands do not make that requirement explicit. Possible approaches to address this failure could be a blanket statement that an operand whose value category is not stated is assumed to be a prvalue; adding prvalue requirements to each operand description for which it is missing; or changing the description of the usual arithmetic conversions to state that they imply the lvalue-to-rvalue conversion, which would cover the majority of the omissions.
(See also issue 1685, which deals with an inaccurately-specified value category.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-12-19 10:15:28 | admin | set | status: dr -> drwp |
2023-07-16 13:00:43 | admin | set | status: ready -> dr |
2023-04-29 20:31:58 | admin | set | messages: + msg7263 |
2023-04-29 20:31:58 | admin | set | status: open -> ready |
2013-03-15 00:00:00 | admin | create |