See Order or Static Construction. http://www.digitalmars.com/d/1.0/module.html
<http://www.digitalmars.com/d/1.0/module.html>Circular dependencies are allowed so long as not both of the modules contain static ctors or dtors, else will result in a runtime exception. The very simplest example of this is: === a.d === module a; import b; class A { static this() {} } === b.d === module b; import a; class B { static this() {} } === main.d === void main() {} I don't think this is really a compiler bug per se, but attached is a patch for torus that should resolve the conflict and still satisfy runtime. Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
diff -ur torus-trooper-0.22.dfsg1.orig/src/abagames/tt/particle.d torus-trooper-0.22.dfsg1/src/abagames/tt/particle.d --- torus-trooper-0.22.dfsg1.orig/src/abagames/tt/particle.d 2005-01-01 21:40:28.000000000 +0000 +++ torus-trooper-0.22.dfsg1/src/abagames/tt/particle.d 2010-05-31 01:25:09.788741816 +0100 @@ -26,7 +26,7 @@ private: static const float GRAVITY = 0.02; static const float SIZE = 0.3; - static Rand rand; + static Rand _rand; Tunnel tunnel; Ship ship; Vector3 pos; @@ -42,8 +42,11 @@ float d1, d2, md1, md2; float width, height; - public static this() { - rand = new Rand; + public static Rand rand() { + if (_rand is null) + _rand = new Rand; + + return _rand; } public static void setRandSeed(long seed) { diff -ur torus-trooper-0.22.dfsg1.orig/src/abagames/tt/shape.d torus-trooper-0.22.dfsg1/src/abagames/tt/shape.d --- torus-trooper-0.22.dfsg1.orig/src/abagames/tt/shape.d 2004-11-12 23:46:02.000000000 +0000 +++ torus-trooper-0.22.dfsg1/src/abagames/tt/shape.d 2010-05-31 01:24:29.344714781 +0100 @@ -58,7 +58,7 @@ SMALL, MIDDLE, LARGE } private: - static Rand rand; + static Rand _rand; Structure[] structure; Vector _collision; DisplayList displayList; @@ -66,8 +66,11 @@ Vector rocketPos, fragmentPos; int color; - static this() { - rand = new Rand; + static Rand rand() { + if (_rand is null) + _rand = new Rand; + + return _rand; } public this(long randSeed) {