[Issue 7470] New: opEquals for interfaces
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 8 23:41:46 PST 2012
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: nobody at puremagic.com
ReportedBy: dawg at dawgfoto.de
--- Comment #0 from dawg at 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: -------
More information about the Digitalmars-d-bugs
mailing list