[Issue 7834] New: Assign x%int to int without cast?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 5 17:35:18 PDT 2012


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

           Summary: Assign x%int to int without cast?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-04-05 17:35:56 PDT ---
In DMD 2.059beta this code compiles with no warnings or errors:


void main(string[] args) {
    uint x;
    ubyte y = cast(ubyte)args.length;
    ubyte z = x % y;
}


So I'd like code similar to this too to compile with no need of a cast:


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


Currently it gives:
test.d(4): Error: cannot implicitly convert expression (x % cast(ulong)y) of
type ulong to int

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


More information about the Digitalmars-d-bugs mailing list