Description
When there is a move assignment implemented, the copy assignment is ignored, even though it is the correct function to call.
struct S
{
int data;
~this() // I. destructor
{ assert(true); }
this(ref return scope S) // II. copy constructor
{ assert(false); }
ref S opAssign(const ref S) // III. copy assignment
{ return this; }
this(return scope S) // IV. move constructor
{ assert(false); }
ref S opAssign(const S) // V. move assignment
{ assert(false); }
}
void test()
{
S o1, o2;
o2 = o1; // Should use III, instead uses II + V.
}
Remove the move assignment, and the copy assignment path is correctly used.
Metadata
Metadata
Assignees
Labels
No labels