digitalmars.D.bugs - [Issue 16353] New: Virtual function cannot be declared and defined
- via Digitalmars-d-bugs (31/31) Aug 05 2016 https://issues.dlang.org/show_bug.cgi?id=16353
https://issues.dlang.org/show_bug.cgi?id=16353 Issue ID: 16353 Summary: Virtual function cannot be declared and defined in the same scope. Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: maxsamukha gmail.com class C { void f(); void f() {} } An overload set of two elements pointing to the same function is created. This results in messed-up vtbl containing duplicate entries: class D : C { alias f = C.f; override void f() { } } 1. 'alias' is required because of the abnormal overload set. 2. Only the first pointer to f is overridden in D's vtbl. C c = new D; c.f() // second pointer in D's vtbl is used (C.f) Related to bug 8108. --
Aug 05 2016