D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2683 - Cannot implement interface methods by alias
Summary: Cannot implement interface methods by alias
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P3 normal
Assignee: No Owner
URL:
Keywords:
: 2244 (view as issue list)
Depends on:
Blocks:
 
Reported: 2009-02-22 09:05 UTC by Neia Neutuladh
Modified: 2024-12-13 17:49 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Neia Neutuladh 2009-02-22 09:05:16 UTC
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 Neia Neutuladh 2009-02-22 18:22:29 UTC
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 Stewart Gordon 2009-02-22 20:09:59 UTC
This is a generalisation of issue 2565/issue 502.
Comment 3 Fawzi Mohamed 2010-04-14 07:49:13 UTC
*** Issue 2244 has been marked as a duplicate of this issue. ***
Comment 4 dlangBugzillaToGithub 2024-12-13 17:49:27 UTC
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