Comment #0 by bearophile_hugs — 2010-03-28T06:30:20Z
Problem found in dmd 2.042. This doesn't compile:
int foo() {
int[int] aa;
aa[1] = 2;
return 0;
}
enum _ = foo();
void main() {}
Giving the errors:
test.d(3): Error: Cannot index null array aa
test.d(6): Error: cannot evaluate foo() at compile time
test.d(6): Error: cannot evaluate foo() at compile time
Comment #1 by bugzilla — 2010-04-01T13:54:06Z
changeset 429
Comment #2 by clugdbug — 2010-04-09T19:20:38Z
Fixed DMD1.058 and DMD2.043.
Comment #3 by puremagic — 2012-11-09T02:32:55Z
It seems that when I use an 2D AA this problem still occurs.
This is the code I used:
enum auto i = test();
int test()
{
string[][string] s;
s["a"] ~= "anything";
return 6;
}
It gives me almost the same error (on Linux x64) the OP had:
Error: cannot index null array s
Comment #4 by clugdbug — 2012-11-14T01:38:11Z
(In reply to comment #3)
> It seems that when I use an 2D AA this problem still occurs.
Your test case is completely different to the original bug, it is a bug in ~=.
Please do not reopen ancient bugs. The *only* time you should open a bug which was listed as fixed in a previous changelog, is if you find that the test cases in bug weren't actually fixed in that release.
Moved to bug 9023.