[Bug 34] New: C style cast illegal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 11 06:24:56 PST 2006


http://d.puremagic.com/bugzilla/show_bug.cgi?id=34

           Summary: C style cast illegal
           Product: D
           Version: 0.149
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: braddr at puremagic.com
        ReportedBy: benoit at tionex.de


I think this should be no error?

void main()
{
    uint[10] arr1;
    ulong idx = 3;
    //uint[] arr2 = arr1[ idx .. idx + 3 ]; // Error if with compiler switch -w 
    uint[] arr3 = arr1[ cast(int)(idx) .. (cast(int) idx) + 3  ]; // OK
    uint[] arr4 = arr1[ cast(int) idx  ..  cast(int) idx  + 3  ]; // OK
    uint[] arr5 = arr1[ cast(int)(idx) ..  cast(int)(idx) + 3  ]; // C style
cast illegal, use cast(idx)+3
    uint[] arr6 = arr1[ cast(int)(idx) ..  cast(int)(idx  + 3) ]; // OK
}


-- 




More information about the Digitalmars-d-bugs mailing list