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

          Issue ID: 14944
           Summary: cannot initialize static array by static this()
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

Following code prints "0" using
DMD32 D Compiler v2.068.0

import std.stdio;
class Foo {
    static int[10] tbl;
    static this() {
        foreach(ref v; tbl) {
            v = 1;
        }
    }
}
void main() {
    writeln(Foo.tbl[0]);
}

--

Reply via email to