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

           Summary: opEquals for interfaces
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@dawgfoto.de 2012-02-08 23:41:44 PST ---
interface I
{
    int value();
    equals_t opEquals(I other);
    // final opEquals should be allowed too
    // final equals_t opEquals(I other) { return value() == other.value(); }
}

class A : I
{
    override int value() { return 0; }
    override equals_t opEquals(I other) { return value() == other.value(); }
}

class B : I
{
    override int value() { return 0; }
    override equals_t opEquals(I other) { return value() == other.value(); }
}

void main()
{
    I i1 = new A, i2 = new B;
    assert(i1 == i2);
}

----

I think this was the actual issue that Steven filed under bug 4088.
Using explicit casts solved compiler generated interface comparison,
but doesn't allow a real opEquals for interfaces.

Note that opCmp works as expected.

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

Reply via email to