Ali Cehreli wrote:
Don Wrote:
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>.
Thank you for the quick fix! :)
But I still can't parse the answer that I am looking for. :)
The compiler should pass the assertion, ok, but what should itdo after that?
a) Reject both
b) Accept both
c) Accept static_0 but reject static_1
Option c would contradict with the documentattion though:
http://digitalmars.com/d/2.0/arrays.html
It says: "Static arrays are distinguished by having a length fixed at compile
time."
'static' means two different things. There, it means 'fixed length'.
It can also mean 'in the static data segment' which is quite different.
This terminology causes a lot of confusion.
Also says: "Static Initialization of Static Arrays: Static initalizations are
supplied by a list of array element values enclosed in [ ]. The values can be optionally
preceded by an index and a :."
Those definitions make me think that both static_0 and static_1 should both be
accepted.
Definitely they should, eventually. But right now, the compiler
generates really terrible code for array assignments anyway, so you're
not losing much.