www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2683] New: Cannot implement interface methods by alias

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2683

           Summary: Cannot implement interface methods by alias
           Product: D
           Version: 1.039
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dhasenan gmail.com


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).


-- 
Feb 22 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2683


dhasenan gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.039                       |1.00




------- Comment #1 from dhasenan gmail.com  2009-02-22 18:22 -------
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.


-- 
Feb 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2683


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com




------- Comment #2 from smjg iname.com  2009-02-22 20:09 -------
This is a generalisation of issue 2565/issue 502.


-- 
Feb 22 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2683


Fawzi Mohamed <fawzi gmx.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |elite01 gmx.de


--- Comment #3 from Fawzi Mohamed <fawzi gmx.ch> 2010-04-14 07:49:13 PDT ---
*** Issue 2244 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 14 2010