Bug 3206 – Class used as its member function parameter's default value is considered implementating only lexically preceeding abstract functions

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2009-07-24T00:39:45Z
Last change time
2020-03-21T03:56:39Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Max Samukha
Blocks
340

Comments

Comment #0 by samukha — 2009-07-24T00:39:45Z
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) { } }
Comment #1 by verylonglogin.reg — 2014-07-18T10:08:59Z
--- 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.