I'm trying to initialize an AA, but initializing at definition fails, as
do in a shared module ctor.
// how is this now constant?
//shared string[int] aa = [1: "a"]; // Error: non-constant expression
[1:"a"]
// ok
string[int] aa2;
static this()
{
aa2 = [1: "a"];
}
// The same with shared fails
// segfault
/+
shared string[int] aa3;
shared static this()
{
aa3 = [1: "a"];
}
+/
// Using __gshared works though
__gshared string[int] aa4;
shared static this()
{
aa4 = [1: "a"];
}
void main() {
assert(aa4[1] == "a");
}