http://d.puremagic.com/issues/show_bug.cgi?id=7834



--- Comment #7 from bearophile_h...@eml.cc 2012-04-24 19:39:48 PDT ---
(In reply to comment #6)

> These two bits of code aren't analogous.
> If y was -1, when cast to ulong it becomes 0xFFFF_FFFF_FFFF_FFFF
> Therefore, x % y could be 0.. ulong.max; there's no way that can fit into an
> int.
> The compiler is correct.

You are of course right, thank you Don and sorry SomeDude.


> OTOH if you change int -> uint, it works.


Right, this compiles:

void main() {
    ulong x;
    uint y = 1;
    int z = x % y;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to