[Issue 1048] the type matching of static initialization

Stewart Gordon smjg_1998 at yahoo.com
Wed Mar 14 13:00:14 PDT 2007


Jarrett Billingsley Wrote:

<snip>
> 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

As I've begun to say before, array literals ought to be multi-typed in much the same way as string literals are.

But even so, it should be possible to make the compiler treat it as an initializer rather than an array literal; then there would be no problem.

Stewart.


More information about the Digitalmars-d-bugs mailing list