On Friday, 11 January 2013 at 10:16:28 UTC, Jens Mueller wrote:
deadalnix wrote:
On Friday, 11 January 2013 at 08:55:55 UTC, Bernard Helyer wrote:
>I completely agree. Doesn't the spec say that relying on
>the order of assignment evaluation is undefined?

After a long discussion with Andrei, it seems that it is left to
right.

Then the spec should be fixed.

unittest
{
        int a = 0;
        ++a = a;
        assert(a == 1);
}


++a isn't supposed to be an lvalue (it is not assignable).

Don't know though whether you find it surprising that the above code passes? But whether it is left to right or right to left does not matter
that much. At least it's defined and you can internalize it.
The more I think about the more sense it makes to have it left to right.


It shouldn't pass as the entry has never been assigned when computing the value.

Reply via email to