abstract class A { abstract void foo(); } class B : A { void bar(B b = new B) { } void foo() { } } void main() { auto a = new B; } ---- test.d(19): Error: cannot create instance of abstract class B test.d(19): Error: function foo is abstract The bug can be worked around by placing 'foo' before 'bar': class B : A { void foo() { } void bar(B b = new B) { } }
--- class B { abstract void f(); } class C: B { void g(C c = new C) { } // put after `f` to detrigger the issue override void f() { } } --- Note `interface` implementations are not affected.