'static' keyword for positional array initialization
Don
nospam at nospam.com
Wed Aug 12 05:27:28 PDT 2009
Ali Cehreli wrote:
> Lars T. Kyllingstad Wrote:
>
>> I've tried with DMD 2.031, and I can't reproduce this. This works fine
>> for me:
>>
>> int[2] static_0 = [ 1, 1 ]:
>> int[2] static_1 = [ 1:1 ];
>>
>> Where did you put the declarations? I've tried putting them at both
>> module level and in a class, and both times it compiled without problems.
>
> Thank you very much for both of your answers. :)
>
> I hadn't realized that the location of the definitions would make a difference. As you say, both of the lines work for me in the global scope (probably in a class too), but not in main:
>
> void main()
> {
> int[2] static_0 = [ 1, 1 ];
> int[2] static_1 = [ 1:1 ];
> }
>
> dmd: init.c:431: virtual Expression* ArrayInitializer::toExpression(): Assertion `j < edim' failed.
I've added this to Bugzilla as bug 3246. With a patch <g>.
More information about the Digitalmars-d-learn
mailing list