This syntax is covered by C++17 [expr.ass]/9:
A braced-init-list may appear on the right-hand side of
- [...]
- 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.
with an example given:
z = { 1,2 }; // meaning z.operator=({1,2})
The behaviour of giving a braced-init-list as argument to a function means that the function parameter is initialized by that list. In this case Data&& other
is initialized by {1, 2}
. This is covered by [dcl.init.list]/3.4:
Otherwise, if T
is a reference type, a prvalue of the type referenced by T
is generated. The prvalue initializes its result object by copy-list-initialization or direct-list-initialization, depending on the kind of initialization for the reference. The prvalue is then used to direct-initialize the reference.
So there is a prvalue of type Data
initialized by {1, 2}
which becomes the initializer for the parameter of operator=
.