From Jason Turner

[expr.ass]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2_f1svfp/{from.md → to.md} +25 -26
tmp/tmp2_f1svfp/{from.md → to.md} RENAMED
@@ -1,64 +1,63 @@
1
- ## Assignment and compound assignment operators <a id="expr.ass">[[expr.ass]]</a>
2
 
3
  The assignment operator (`=`) and the compound assignment operators all
4
  group right-to-left. All require a modifiable lvalue as their left
5
- operand and return an lvalue referring to the left operand. The result
6
- in all cases is a bit-field if the left operand is a bit-field. In all
7
- cases, the assignment is sequenced after the value computation of the
8
- right and left operands, and before the value computation of the
9
  assignment expression. The right operand is sequenced before the left
10
  operand. With respect to an indeterminately-sequenced function call, the
11
  operation of a compound assignment is a single evaluation.
12
 
13
- [*Note 1*: Therefore, a function call shall not intervene between the
14
  lvalue-to-rvalue conversion and the side effect associated with any
15
  single compound assignment operator. — *end note*]
16
 
17
  ``` bnf
18
  assignment-expression:
19
  conditional-expression
20
- logical-or-expression assignment-operator initializer-clause
21
  throw-expression
 
22
  ```
23
 
24
  ``` bnf
25
  assignment-operator: one of
26
  '= *= /= %= += -= >>= <<= &= ^= |='
27
  ```
28
 
29
- In simple assignment (`=`), the value of the expression replaces that of
30
- the object referred to by the left operand.
 
31
 
32
- If the left operand is not of class type, the expression is implicitly
33
- converted (Clause  [[conv]]) to the cv-unqualified type of the left
34
- operand.
35
-
36
- If the left operand is of class type, the class shall be complete.
37
- Assignment to objects of a class is defined by the copy/move assignment
38
- operator ([[class.copy]],  [[over.ass]]).
39
-
40
- [*Note 2*: For class objects, assignment is not in general the same as
41
- initialization ([[dcl.init]],  [[class.ctor]],  [[class.init]], 
42
- [[class.copy]]). — *end note*]
43
 
44
  When the left operand of an assignment operator is a bit-field that
45
  cannot represent the value of the expression, the resulting value of the
46
  bit-field is *implementation-defined*.
47
 
48
- The behavior of an expression of the form `E1` *op*`=` `E2` is
49
- equivalent to `E1 = E1` *op* `E2` except that `E1` is evaluated only
50
- once. In `+=` and `-=`, `E1` shall either have arithmetic type or be a
51
- pointer to a possibly cv-qualified completely-defined object type. In
52
- all other cases, `E1` shall have arithmetic type.
 
 
 
 
 
 
53
 
54
  If the value being stored in an object is read via another object that
55
  overlaps in any way the storage of the first object, then the overlap
56
  shall be exact and the two objects shall have the same type, otherwise
57
  the behavior is undefined.
58
 
59
- [*Note 3*: This restriction applies to the relationship between the
60
  left and right sides of the assignment operation; it is not a statement
61
  about how the target of the assignment may be aliased in general. See 
62
  [[basic.lval]]. — *end note*]
63
 
64
  A *braced-init-list* may appear on the right-hand side of
 
1
+ ### Assignment and compound assignment operators <a id="expr.ass">[[expr.ass]]</a>
2
 
3
  The assignment operator (`=`) and the compound assignment operators all
4
  group right-to-left. All require a modifiable lvalue as their left
5
+ operand; their result is an lvalue referring to the left operand. The
6
+ result in all cases is a bit-field if the left operand is a bit-field.
7
+ In all cases, the assignment is sequenced after the value computation of
8
+ the right and left operands, and before the value computation of the
9
  assignment expression. The right operand is sequenced before the left
10
  operand. With respect to an indeterminately-sequenced function call, the
11
  operation of a compound assignment is a single evaluation.
12
 
13
+ [*Note 1*: Therefore, a function call cannot intervene between the
14
  lvalue-to-rvalue conversion and the side effect associated with any
15
  single compound assignment operator. — *end note*]
16
 
17
  ``` bnf
18
  assignment-expression:
19
  conditional-expression
20
+ yield-expression
21
  throw-expression
22
+ logical-or-expression assignment-operator initializer-clause
23
  ```
24
 
25
  ``` bnf
26
  assignment-operator: one of
27
  '= *= /= %= += -= >>= <<= &= ^= |='
28
  ```
29
 
30
+ In simple assignment (`=`), the object referred to by the left operand
31
+ is modified [[defns.access]] by replacing its value with the result of
32
+ the right operand.
33
 
34
+ If the right operand is an expression, it is implicitly converted
35
+ [[conv]] to the cv-unqualified type of the left operand.
 
 
 
 
 
 
 
 
 
36
 
37
  When the left operand of an assignment operator is a bit-field that
38
  cannot represent the value of the expression, the resulting value of the
39
  bit-field is *implementation-defined*.
40
 
41
+ A simple assignment whose left operand is of a volatile-qualified type
42
+ is deprecated [[depr.volatile.type]] unless the (possibly parenthesized)
43
+ assignment is a discarded-value expression or an unevaluated operand.
44
+
45
+ The behavior of an expression of the form `E1 op= E2` is equivalent to
46
+ `E1 = E1 op E2` except that `E1` is evaluated only once. Such
47
+ expressions are deprecated if `E1` has volatile-qualified type; see 
48
+ [[depr.volatile.type]]. For `+=` and `-=`, `E1` shall either have
49
+ arithmetic type or be a pointer to a possibly cv-qualified
50
+ completely-defined object type. In all other cases, `E1` shall have
51
+ arithmetic type.
52
 
53
  If the value being stored in an object is read via another object that
54
  overlaps in any way the storage of the first object, then the overlap
55
  shall be exact and the two objects shall have the same type, otherwise
56
  the behavior is undefined.
57
 
58
+ [*Note 2*: This restriction applies to the relationship between the
59
  left and right sides of the assignment operation; it is not a statement
60
  about how the target of the assignment may be aliased in general. See 
61
  [[basic.lval]]. — *end note*]
62
 
63
  A *braced-init-list* may appear on the right-hand side of