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