On Friday, 13 July 2012 at 18:09:59 UTC, Era Scarecrow wrote:
I would think the best solution is to create a mutable local version, and then assign the immutable global one when you are done.

Thanks for the workaround. But I'm actually more interested in whether or not this is a compiler bug or not, so that I could file a bug report. The following code makes me more certain that this in fact is a bug. Because in some sense there shouldn't be much difference between int and a fixed size int array of size 1:

module main;

import std.stdio;

immutable(int)    value;
immutable(int[1]) staticArray;

shared static this()
{
    value = 123;          // OK
    staticArray[0] = 123; // Error: staticArray[0] isn't mutable
}

int main(string args[])
{
    writeln(value);
    readln();
    return 0;
}


Reply via email to