this test passes: uint x = 0; (x += 1) %= 2; assert (x == 1); ubyte y = 0; (y += 1) %= 2; assert (y == 0); // though I expected y == 1 y += 1; y %= 2; assert (y == 1); // this is correct using dmd from debian package dmd-bin v2.065.0-0
This is working since 2.067.1 according to run.dlang.io void main() { uint x = 0; (x += 1) %= 2; assert (x == 1); ubyte y = 0; (y += 1) %= 2; assert (y == 1); y += 1; y %= 2; assert (y == 0); }