templated static array

Kenji Hara k.hara.pg at gmail.com
Mon Oct 15 11:04:30 PDT 2012


On Monday, 15 October 2012 at 17:05:30 UTC, Simen Kjaeraas wrote:
> On 2012-35-15 17:10, Namespace <rswhite4 at googlemail.com> wrote:
>
>> But bar([1, 2, 3]); not. The compiler does not realize that 
>> [1, 2, 3] means a static array in this context.
>> You have to write bar(cast(int[3]) [1, 2, 3]); but I think the 
>> compiler have to recognize this on it's own.
>
> This is true. The problem is, as you say, that the compiler 
> treats array
> literals as dynamic rather than static arrays. I would argue 
> this is the
> correct default, but it's obviously not the default you want 
> here.
>
> bearophile has posted about this on numerous occasions, and 
> it's among
> his top thousand wanted features. :p

I think this is a bug in IFTE.
Please file it into bugzilla.

Kenji Hara


More information about the Digitalmars-d-learn mailing list