Why can't we detect at compile time module ctor/dtor cycles (instead of runtime) ?
See example below.

It should be easy to detect the chain at CT:

algo:
build graph from import dependencies a=>b if module a imports module b.
mark as red the modules that have a ctor 
collapse each non-red node into its parent (and update parent's edges)
detect cycles (eg BFS)

(same with dtor)


----
a1:
import a2;
void main(){}
static this(){}


a2:
import a3;
static this(){}

a3:
import a1;
----

rdmd --force --build-only -oftest a1 #works
./test #error:
object.Exception@src/rt/minfo.d(243): Aborting: Cycle detected between modules with ctors/dtors:
a1 -> a2 -> a3 -> a1