casting array literals doesn't work as stated in the docs

Trass3r mrmocool at gmx.de
Sun Jan 3 02:36:34 PST 2010


bearophile schrieb:
> What's wrong with just (D2 code):
> short[] a3 = [5, 3];
> 

Nothing, but it's just the stripped down example.

auto t = [0xFF, 0x00];
yields int[]

so for

struct Foo {
...}

auto x = cast(Foo[]) [0x00, 0x01,...];

you need an additional cast(ubyte[]).


Yet this doesn't work:
http://codepad.org/P9EZ0dIB



More information about the Digitalmars-d mailing list