[Issue 8520] Simple "in"-constrained opBinaryRight in interface doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 7 18:26:33 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8520


Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com


--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> 2012-08-07 18:26:30 PDT ---
Your understanding is wrong - templates never go in the vtable.

The solution is to use NVI and forwarding:

interface I
{
    int* opBinaryRight_in(int i);

    int* opBinaryRight(string op : "in")(int i)
    {
        return opBinaryRight_in(i);
    }
}

class C : I
{
    int* opBinaryRight_in(int i)
    {
        return null;
    }
}

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


More information about the Digitalmars-d-bugs mailing list