====== A.d ====== module A; import std.stdio; import B; int Avar; static this() { Avar = 5; writefln(Bvar); } void main() { } ====== B.d ====== module B; import std.stdio; import C; int Bvar; static this() { Bvar = 5; writefln(Avar); } ====== C.d ====== module C; public import A; ================= The program compiles, and outputs: 0 5 (A's constructor gets called before B's). Related code is in _moduleCtor2 from moduleinit.d - if a module has no static constructors/destructors, any circular references in its imported modules are ignored (the skip parameter).
Added to DStress as http://dstress.kuehne.cn/norun/i/import_20_A.d http://dstress.kuehne.cn/norun/i/import_20_B.d http://dstress.kuehne.cn/norun/i/import_20_C.d
Has been fixed in D2 only.
Closing because D1 is no longer supported.