|
246 | 246 |
|
247 | 247 | \pnum
|
248 | 248 | Whenever a glvalue appears as an operand of an operator that
|
249 |
| -expects a prvalue for that operand, the |
| 249 | +requires a prvalue for that operand, the |
250 | 250 | lvalue-to-rvalue\iref{conv.lval}, array-to-pointer\iref{conv.array},
|
251 | 251 | or function-to-pointer\iref{conv.func} standard conversions are
|
252 | 252 | applied to convert the expression to a prvalue.
|
|
518 | 518 | conversions.
|
519 | 519 | \end{note}
|
520 | 520 | A standard conversion sequence will be applied to
|
521 |
| -an expression if necessary to convert it to a required destination type. |
| 521 | +an expression if necessary to convert it to an expression having |
| 522 | +a required destination type and value category. |
522 | 523 |
|
523 | 524 | \pnum
|
524 | 525 | \begin{note}
|
|
1120 | 1121 | which are defined as follows:
|
1121 | 1122 |
|
1122 | 1123 | \begin{itemize}
|
| 1124 | +\item The lvalue-to-rvalue conversion\iref{conv.lval} |
| 1125 | +is applied to each operand and |
| 1126 | +the resulting prvalues are used in place of the original operands |
| 1127 | +for the remainder of this section. |
1123 | 1128 | \item If either operand is of scoped enumeration type\iref{dcl.enum}, no conversions
|
1124 | 1129 | are performed; if the other operand does not have the same type, the expression is
|
1125 | 1130 | ill-formed.
|
|
3169 | 3174 | The postfix expression shall
|
3170 | 3175 | have function type or function pointer type.
|
3171 | 3176 | For a call to a non-member function or to a static member function,
|
3172 |
| -the postfix expression shall either be an lvalue that refers to a |
| 3177 | +the postfix expression shall be either an lvalue that refers to a |
3173 | 3178 | function (in which case the function-to-pointer standard
|
3174 | 3179 | conversion\iref{conv.func} is suppressed on the postfix expression),
|
3175 |
| -or have function pointer type. |
| 3180 | +or a prvalue of function pointer type. |
3176 | 3181 |
|
3177 | 3182 | \pnum
|
3178 | 3183 | If the selected
|
|
4611 | 4616 |
|
4612 | 4617 | \pnum
|
4613 | 4618 | \indextext{operator!unary plus}%
|
4614 |
| -The operand of the unary \tcode{+} operator shall have arithmetic, unscoped |
| 4619 | +The operand of the unary \tcode{+} operator shall be a prvalue of |
| 4620 | +arithmetic, unscoped |
4615 | 4621 | enumeration, or pointer type and the result is the value of the
|
4616 | 4622 | argument. Integral promotion is performed on integral or enumeration
|
4617 | 4623 | operands. The type of the result is the type of the promoted operand.
|
4618 | 4624 |
|
4619 | 4625 | \pnum
|
4620 | 4626 | \indextext{operator!unary minus}%
|
4621 |
| -The operand of the unary \tcode{-} operator shall have arithmetic or unscoped |
| 4627 | +The operand of the unary \tcode{-} operator shall be a prvalue of |
| 4628 | +arithmetic or unscoped |
4622 | 4629 | enumeration type and the result is the negative of its operand. Integral
|
4623 | 4630 | promotion is performed on integral or enumeration operands. The negative
|
4624 | 4631 | of an unsigned quantity is computed by subtracting its value from $2^n$,
|
|
4639 | 4646 |
|
4640 | 4647 | \pnum
|
4641 | 4648 | \indextext{operator!ones' complement}%
|
4642 |
| -The operand of the \tcode{\~{}} operator shall have integral or unscoped enumeration type. |
| 4649 | +The operand of the \tcode{\~{}} operator shall be a prvalue of |
| 4650 | +integral or unscoped enumeration type. |
4643 | 4651 | Integral promotions are performed.
|
4644 | 4652 | The type of the result is the type of the promoted operand.
|
4645 | 4653 | % FIXME: [basic.fundamental]/p5 uses $x_i$; [expr] uses $\tcode{x}_i$.
|
|
5655 | 5663 | that consists of empty square brackets can follow the \keyword{delete} keyword
|
5656 | 5664 | if the \grammarterm{lambda-expression} is enclosed in parentheses.
|
5657 | 5665 | \end{footnote}
|
5658 |
| -The operand shall be of pointer to object type or of class type. If of |
5659 |
| -class type, the operand is contextually implicitly converted\iref{conv} |
| 5666 | +If the operand is of |
| 5667 | +class type, it is contextually implicitly converted\iref{conv} |
5660 | 5668 | to a pointer to object
|
5661 | 5669 | type.
|
5662 | 5670 | \begin{footnote}
|
5663 | 5671 | This implies that an object
|
5664 | 5672 | cannot be deleted using a pointer of type
|
5665 | 5673 | \tcode{\keyword{void}*} because \keyword{void} is not an object type.
|
5666 | 5674 | \end{footnote}
|
| 5675 | +Otherwise, it shall be a prvalue of pointer to object type. |
5667 | 5676 | The \grammarterm{delete-expression} has type
|
5668 | 5677 | \keyword{void}.
|
5669 | 5678 |
|
|
6020 | 6029 |
|
6021 | 6030 | \pnum
|
6022 | 6031 | The binary operator \tcode{.*} binds its second operand, which shall be
|
| 6032 | +a prvalue |
6023 | 6033 | of type ``pointer to member of \tcode{T}'' to its first operand, which shall be
|
6024 | 6034 | a glvalue
|
6025 | 6035 | of
|
|
6029 | 6039 |
|
6030 | 6040 | \pnum
|
6031 | 6041 | The binary operator \tcode{->*} binds its second operand, which shall be
|
| 6042 | +a prvalue |
6032 | 6043 | of type ``pointer to member of \tcode{T}'' to its first operand, which shall be of
|
6033 | 6044 | type ``pointer to \tcode{U}''
|
6034 | 6045 | where \tcode{U} is either \tcode{T} or
|
|
6152 | 6163 | \indextext{operator!additive}
|
6153 | 6164 |
|
6154 | 6165 | \pnum
|
6155 |
| -The additive operators \tcode{+} and \tcode{-} group left-to-right. The |
6156 |
| -usual arithmetic conversions\iref{expr.arith.conv} are performed for operands of arithmetic or |
6157 |
| -enumeration type. |
| 6166 | +The additive operators \tcode{+} and \tcode{-} group left-to-right. |
| 6167 | +Each operand shall be a prvalue. |
| 6168 | +If both operands have arithmetic or unscoped enumeration type, |
| 6169 | +the usual arithmetic conversions\iref{expr.arith.conv} are performed. |
| 6170 | +Otherwise, if one operand has arithmetic or unscoped enumeration type, |
| 6171 | +integral promotion is applied\iref{conv.prom} to that operand. |
| 6172 | +A converted or promoted operand is used in place of |
| 6173 | +the corresponding original operand for the remainder of this section. |
6158 | 6174 |
|
6159 | 6175 | \indextext{operator!addition}%
|
6160 | 6176 | \indextext{addition operator|see{operator, addition}}%
|
|
6171 | 6187 | \end{bnf}
|
6172 | 6188 |
|
6173 | 6189 | \indextext{incomplete}%
|
6174 |
| -For addition, either both operands shall have arithmetic or unscoped enumeration |
| 6190 | +For addition, either both operands shall have arithmetic |
6175 | 6191 | type, or one operand shall be a pointer to a completely-defined object
|
6176 |
| -type and the other shall have integral or unscoped enumeration type. |
| 6192 | +type and the other shall have integral type. |
6177 | 6193 |
|
6178 | 6194 | \pnum
|
6179 | 6195 | For subtraction, one of the following shall hold:
|
6180 | 6196 | \begin{itemize}
|
6181 |
| -\item both operands have arithmetic or unscoped enumeration type; or |
| 6197 | +\item both operands have arithmetic type; or |
6182 | 6198 |
|
6183 | 6199 | \item
|
6184 | 6200 | \indextext{arithmetic!pointer}%
|
6185 | 6201 | both operands are pointers to cv-qualified or cv-unqualified
|
6186 | 6202 | versions of the same completely-defined object type; or
|
6187 | 6203 |
|
6188 | 6204 | \item the left operand is a pointer to a completely-defined object type
|
6189 |
| -and the right operand has integral or unscoped enumeration type. |
| 6205 | +and the right operand has integral type. |
6190 | 6206 | \end{itemize}
|
6191 | 6207 |
|
6192 | 6208 | \pnum
|
|
6289 | 6305 | shift-expression \terminal{>>} additive-expression
|
6290 | 6306 | \end{bnf}
|
6291 | 6307 |
|
6292 |
| -The operands shall be of integral or unscoped enumeration type and integral |
| 6308 | +The operands shall be prvalues of integral or unscoped enumeration type and integral |
6293 | 6309 | promotions are performed. The type of the result is that of the promoted
|
6294 | 6310 | left operand.
|
6295 | 6311 | \indextext{left shift!undefined}%
|
|
0 commit comments