June 02, 2011 [Issue 6092] New: Can't cast primitive to same-sized static array | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: cbkbbejeap@mailinator.com --- Comment #0 from Nick Sabalausky <cbkbbejeap@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: ------- |
Copyright © 1999-2021 by the D Language Foundation