Can anyone explain to me why this test passes? I have read through the Types page on the dlang website and can't find anything that would explain this. Is it a bug or am I doing it wrong?

        uint x = 0;
        (x += 1) %= 2;
        assert (x == 1);
        ubyte y = 0;
        (y += 1) %= 2;
        assert (y != 1);
        // though I expected y == 1

Here's a table of all the types I tried ++x %= 2, where x has type long (L), int (I), etc:
        L       I       S       B       uL      uI      uS      uB
        1       1       0       0       1       1       0       0
        0       0       0       0       0       0       0       0
        1       1       0       0       1       1       0       0
        0       0       0       0       0       0       0       0

It all seems very odd.

Reply via email to