https://issues.dlang.org/show_bug.cgi?id=16491
Issue ID: 16491 Summary: Forward referencing and static/shared static module constructors break initialisation Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: blocker Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: goober...@gmail.com Tested on dmd.2.071.1.windows and dmd.2.071.2-b3.windows. Marked as blocker as it means Binderoo can't support forward referenced pointers as is common in the C++ codebases it is trying to auto-bind. Problem is really simple to reproduce in an isolated environment. Add two modules like this in a program: someclass.d: module someclass; import someotherclass; struct SomeClass { SomeOtherClass* pSomeOtherClass; } shared static this() { someClassName = SomeClass.stringof; } __gshared string someClassName; someotherclass.d: module someotherclass; import someclass; struct SomeOtherClass { SomeClass* pSomeClass; } shared static this() { someOtherClassName = SomeOtherClass.stringof; } __gshared string someOtherClassName; Output at runtime: object.Exception@src\rt\minfo.d(167): Aborting: Cycle detected between modules with shared ctors/dtors: someclass* -> someotherclass* -> someclass Execution subsequently does not reach main. Expected result: Program initialises correctly and executes as expected. --