Bug 16353 – Virtual function cannot be declared and defined in the same scope.

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-08-05T09:58:52Z
Last change time
2024-12-13T18:49:23Z
Assigned to
No Owner
Creator
Max Samukha
Moved to GitHub: dmd#19168 →

Comments

Comment #0 by maxsamukha — 2016-08-05T09:58:52Z
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.
Comment #1 by robert.schadek — 2024-12-13T18:49:23Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19168 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB