how to avoid "cycle detected"?

aki via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 1 02:09:52 PDT 2015


Following code causes run-time error.
How can I use static this() without causing error?
It's difficult to avoid this situation because
actual code is more complex.

file main.d:
void main() {
}

file a.d:
import b;
class A {
	static this() {}
};

file b.d:
import a;
class B {
	static this() {}
};

object.Exception at src\rt\minfo.d(162): Aborting: Cycle detected 
between modules w
ith ctors/dtors:
a -> b -> a




More information about the Digitalmars-d-learn mailing list