Bug 958 – opEquals and opCmp doesn't take Object anymore

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-02-13T08:49:00Z
Last change time
2014-02-16T15:23:12Z
Keywords
spec
Assigned to
bugzilla
Creator
torhu

Comments

Comment #0 by torhu — 2007-02-13T08:49:53Z
class C { bool opCmp(Object) { return true; } } void main() { C c1 = new C; C c2 = new C; if (c1 == c2) { } } This produces the error: opcmp.d(2): function opcmp.C.opCmp of type bool(Object) overrides but is not cov ariant with object.Object.opCmp of type int(Object o) The same thing applies to opEquals. So the section called "Overloading == and !=" is doesn't match the compiler's behavior anymore.
Comment #1 by torhu — 2007-02-13T08:56:01Z
Nevermind. I used 'bool opCmp(Object)' instead of 'int opCmp(Object)'. How embarrassing.