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

           Summary: Some integer interval analysis to avoid some casts
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-02-05 06:07:05 PST ---
This little D2 program shows code that's correct:

void main() {
    uint i = 10;
    ubyte x1 = i % ubyte.max;
    ulong l = 10;
    uint x2 = l % uint.max;
}


But dmd 2.051 asks for casts:
test.d(3): Error: cannot implicitly convert expression (i % 255u) of type uint
to ubyte
test.d(5): Error: cannot implicitly convert expression (l % 4294967295LU) of
type ulong to uint

I think those casts are not necessary, so I'd like dmd to avoid asking for
casts in such situations.

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

Reply via email to