Bug 3441 – Snow Leopard: Static constructors do not work

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
Mac OS X
Creation time
2009-10-25T22:43:00Z
Last change time
2014-04-18T09:12:06Z
Keywords
wrong-code
Assigned to
nobody
Creator
david

Comments

Comment #0 by david — 2009-10-25T22:43:19Z
import std.stdio; class Foo { static int foo = 42; static this() { writefln("static constructor"); foo = 128; } } int main() { writefln("main: %s", Foo.foo); return 0; } will print "main: 42" Static constructor never called. (Same code works as expected on normal Leopard, this has only been seen on Snow Leopard)
Comment #1 by sean — 2010-06-08T10:07:23Z
Verified as fixed against DMD 2.046. I'll look at DMD1x as well to be sure.