Presence of struct destructor makes lvalue?

Maxim Fomin maxim at maxim-fomin.ru
Mon Apr 8 12:24:20 PDT 2013


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


More information about the Digitalmars-d mailing list