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

--- Comment #0 from Nick Sabalausky <> 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:
------- You are receiving this mail because: -------

Reply via email to