DMD often inserts temporaries when they are unexpected (or users do not expect when they should).

D main function in destructor case is rewritten as:

   S s = S(1);
   s.opAssign(foo(2));
   s.opAssign((S __sl1779 = S(3); , __sl1779))

Hence, ref version is taken in account because '__sl1779' is a good lvalue.

Troubles seems to come from https://github.com/D-Programming-Language/dmd/blob/master/src/expression.c#L4203

Reply via email to