March 12, 2010
The D specs are missing a detailed explanation how array casting works.
(I also found a 2 years old issue about it:

It needs to be clarified when a reinterpret_cast is done and when the elements are converted to the new type depending on whether it is an array literal, another array expression, an array of structs, classes or interfaces AND whether it is a constant array or not.
A sane and consistent solution is required.

The only information at all is hidden deep inside the huge expressions documentation:

(Also, is this information correct? For example I thought array literals are dynamic arrays now ("The AssignExpressions form the elements of a static array")?
Additionally: "The type of the first element is taken to be the type of all the elements" ->

We already had several discussions about it here: followed by

RGB[256] PALETTE = cast(RGB[256]) [
    0x00, 0x00, 0x00, 0xE3, 0x53, 0x00,
    0xCF, 0x4B, 0x07, 0xBF, 0x43, 0x0F, ...

doesn't work cause of "non-constant expression"

RGB[256] PALETTE = (cast(RGB[]) [
    0x00, 0x00, 0x00, 0xE3, 0x53, 0x00,
    0xCF, 0x4B, 0x07, 0xBF, 0x43, 0x0F, ...
]) (0 .. 256);

compiles, but yields empty structs (cause it tries to cast each element to a struct instance if I'm not mistaken)

RGB[] PALETTE = (cast(RGB*) cast(ubyte[]) [...])[0..256];

makes it work, but of course it's a bit hacky.

Also see:
and my answer:
March 12, 2010
In that RGB example I wanted the array literal to be saved in the executable as a byte array, not as ints.
And this data should be interpreted in the code as an array of RGB structs.
(just did a search, couldn't find the arrays in the executable)
March 12, 2010
k, filed a report:
Top | Discussion index | About this forum | D home