I think this is a bug and i even recall seeing it in bugzilla, but i don't have a link to it.
On Wed, Nov 9, 2011 at 10:43 AM, bearophile <bearophileh...@lycos.com> wrote: > Is it possible to modify DMD to allow a program like: > > > immutable int[int] aa = [1:15, 2: 7]; > void main() {} > > > With the latest DMD it gives: > test.d(1): Error: non-constant expression [1:15,2:7] > > Global immutable associative arrays are handy in script-like programs, I use > them now and then in Python (despite they are not immutable). > This is a workaround for script-like programs, that I sometimes use: > > > immutable int[int] aa; > static this() { > aa = [1:15, 2: 7]; > } > void main() {} > > > But when possible I try to avoid using static this. > > Bye, > bearophile >