Bug 2683 – Cannot implement interface methods by alias

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2009-02-22T09:05:16Z
Last change time
2024-12-13T17:49:27Z
Assigned to
No Owner
Creator
Neia Neutuladh
See also
https://issues.dlang.org/show_bug.cgi?id=3472
Moved to GitHub: dmd#17893 →

Comments

Comment #0 by dhasenan — 2009-02-22T09:05:16Z
interface IFoo { void foo(); } class Foo : IFoo { void bar() {} alias bar foo; } // class iface_alias.Foo interface function IFoo.foo isn't implemented This is a problem for me because I want to implement methods with a template, but my choices for that template are a string mixin or a template mixin, and with a template mixin, I have to alias the template to the desired method. String mixins don't work for this; for example, if the return type is a templated class, string mixins will fail (see #1748). Or if the return type is a public alias to a private type. I'm not aware of a workaround for this (anything that requires manual coding aside from the template is not a valid workaround).
Comment #1 by dhasenan — 2009-02-22T18:22:29Z
ClassDeclaration::findFunc goes through the class's vtbl, and aliases don't make it into the vtbl. It doesn't matter if I force the function to be virtual by overriding it. I can duplicate this on dmd 1.00.
Comment #2 by smjg — 2009-02-22T20:09:59Z
This is a generalisation of issue 2565/issue 502.
Comment #3 by fawzi — 2010-04-14T07:49:13Z
*** Issue 2244 has been marked as a duplicate of this issue. ***
Comment #4 by robert.schadek — 2024-12-13T17:49:27Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17893 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB