This is a follow-up to an earlier question about why I can\'t use a brace-enclosed initializer as an argument to operator+, which was resolved by looking at this earlier que
+=
operator is a compound assignment. The standard explicitly permits initializer lists on the right-hand side of assignments:
§8.5.4/1 [...] Note: List-initialization can be used
...
— on the right-hand side of an assignment (5.17)
§5.17 talks about all assignments, including compound ones:
assignment-expression:
- conditional-expression
- logical-or-expression assignment-operator initializer-clause
- throw-expressionassignment-operator: one of
=
*=
/=
%=
+=
-=
>>=
<<=
&=
ˆ=
|=