Compiling these files with "dmd module1.d" causes DMD to hang with 100% CPU usage; it doesn't respond to ^C and needs to be killed with the task manager. It's annoying!
--- module1.d:
import module2;
import module3;
class FirstClass: FirstInterface
{
mixin Template!(SecondClass);
}
class SecondClass: SecondBaseClass { }
void main() { }
--- module2.d:
import module3;
interface FirstInterface
{
SecondBaseClass func(ThirdClass);
}
template Template( TYPE )
{
TYPE func(ThirdClass)
{
return new TYPE(this);
}
}
--- module3.d:
abstract class SecondBaseClass { }
class ThirdClass { }
Comment #1 by r.a3 — 2007-03-08T09:55:19Z
Sorry, I made a mistake. Is there no way to edit these? module3.d should be:
import module2;
abstract class SecondBaseClass
{
this(FirstInterface) {}
}
class ThirdClass
{
}
Comment #2 by bugs-d — 2009-03-29T23:54:41Z
This appears to be resolved in (or earlier than) DMD 1.041 and 2.026.
It now shows this error message and exits properly:
module2.d(12): constructor module1.SecondClass.this () does not match parameter types (FirstClass)
module2.d(12): Error: expected 0 arguments, not 1
module1.d(8): constructor module1.SecondClass.this no match for implicit super() call in constructor
It compiles fine if I add an explicit constructor to SecondClass calling super(), which I assume is a covariance issue. If that is a bug it should be filed separately.
-[Unknown]