Immutable array initialization in shared static this

Tommi tommitissari at hotmail.com
Fri Jul 13 03:15:33 PDT 2012


The following code doesn't compile. It seems like a compiler bug 
to me, but I can't find a bug report about it. Is it a bug?

private immutable(int[]) constants;

shared static this()
{
     constants.length = 10;
     constants[0] = 123; // Error: constants[0] isn't mutable
}


More information about the Digitalmars-d-learn mailing list