The assignment operator (=) and the compound assignment
operators all group right-to-left.
All
require a modifiable lvalue as their left operand; their result is an lvalue
referring to the left operand.
The result in all cases is a bit-field if
the left operand is a bit-field.
In all cases, the assignment is
sequenced after the
value computation of the right and left operands,
and before the
value computation of the assignment expression.
The right operand is sequenced before the left operand.
With
respect to an indeterminately-sequenced function call, the operation of
a compound assignment is a single evaluation.
Therefore, a function call cannot intervene between the
lvalue-to-rvalue conversion and the side effect associated with any
single compound assignment operator.
In simple assignment (=), the object referred to by the left operand
is modified ([defns.access])
by replacing its value with the result of the right operand.
When the left operand of an assignment operator
is a bit-field that cannot represent the value of the expression, the
resulting value of the bit-field is
implementation-defined.
A simple assignment whose left operand is of
a volatile-qualified type is deprecated ([depr.volatile.type])
unless the (possibly parenthesized) assignment is a discarded-value expression or
an unevaluated operand.
If the value being stored in an object is read via another object that
overlaps in any way the storage of the first object, then the overlap shall be
exact and the two objects shall have the same type, otherwise the behavior is
undefined.
This restriction applies to the relationship
between the left and right sides of the assignment operation; it is not a
statement about how the target of the assignment may be aliased in general.
an assignment to a scalar, in which case the initializer list shall have
at most a single element. The meaning of x ={v}, where T is the
scalar type of the expression x, is that of x = T{v}. The meaning of
x ={} is x = T{}.
an assignment to an object of class type, in which case the initializer
list is passed as the argument to the assignment operator function selected by
overload resolution ([over.ass], [over.match]).
complex<double> z;
z ={1,2}; // meaning z.operator=({1,2})
z +={1, 2}; // meaning z.operator+=({1,2})int a, b;
a = b ={1}; // meaning a=b=1;
a ={1}= b; // syntax error