Is this a bug? Initializing immutable fixed size arrays
Bauss via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 12 02:45:15 PST 2016
On Monday, 12 December 2016 at 06:43:52 UTC, Shachar Shemesh
wrote:
> The following compiles fine:
> immutable char[5] array = x"01 02 03 04 05";
>
> [...]
This doesn't seem like a bug:
> immutable ubyte[5] array = x"01 02 03 04 05";
This however does:
> immutable ubyte[5] array = cast(immutable ubyte []) x"01 02 03
> 04 05";
There's a workaround for this though.
immutable ubyte[5] array = cast(immutable(ubyte[5]))x"01 02 03 04
05";
More information about the Digitalmars-d
mailing list