[Issue 1048] the type matching of static initialization
Jarrett Billingsley
kb3ctd2 at yahoo.com
Sat Mar 10 09:34:49 PST 2007
"torhu" <fake at address.dude> wrote in message
news:esunvd$u81$1 at digitalmars.com...
> d-bugmail at puremagic.com wrote:
>
> That's not static initialization. It needs to be at the module level for
> that, or be declared as 'static ubyte a[3]'.
I think maybe he's just getting terms mixed up.
In any case, to be able to do this in a function, you have to write
ubyte[3] a = [cast(ubyte)1, 2, 3];
The compiler isn't smart enough to figure out that maybe, just maybe, that
array literal should be a ubyte[] instead of an int[]. :P
More information about the Digitalmars-d-bugs
mailing list