[Issue 6092] New: Can't cast primitive to same-sized static array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 2 13:42:57 PDT 2011


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

           Summary: Can't cast primitive to same-sized static array
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: cbkbbejeap at mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap at mailinator.com> 2011-06-02 13:38:32 PDT ---
This works, and is a very useful trick:

struct Foo {uint f;}
void main(){
    Foo a;
    ubyte[] b = cast(ubyte[4])a;
}

However, the following generates an error:

void main(){
    uint a;
    ubyte[] b = cast(ubyte[4])a;
}

The error:
Error: e2ir: cannot cast a of type uint to type ubyte[4u]

-- 
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