[Issue 4923] immutable module variables are modifiable in non-shared module constructors

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 5 10:12:08 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=4923

--- Comment #6 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
An updated example, since Thread.sleep now requires that its argument be a
core.time.Duration:

import core.thread, std.random, std.stdio;

immutable int x;

static this() {
  x = unpredictableSeed;
}

void main() {
  for(;;) {
    (new Thread({ })).start;
    Thread.sleep(seconds(1));
    writeln(x);
  }
}

--


More information about the Digitalmars-d-bugs mailing list