------- Comment #2 from [EMAIL PROTECTED]  2008-11-16 13:54 -------
module a;
import b;
static this(){}
void main(){}

module b;
import a;
static this(){}

====[Command line]====
$ rebuild a
$ ./a
object.Exception: Cyclic dependency in module a

Pretty short.

It makes no sense that the compiler would output an executable that will always
cause a runtime error.  The compiler knows that there is a circular module
dependency, and should be able to issue an error at compile time.

Note, however, that in this case there _is_ no circular dependency.  Even
though the modules are circularly imported and both have static constructors,
the static constructors do not depend on the other module.  This _should_ be
legal, at least semantically.  That the program issues an error means that the
compiler and runtime aren't doing a whole lot of analysis to determine that
there is a cyclic dependency.  It's a false positive.


Reply via email to