Bug 694 – Doc mistake: a == null is not a.opCmp(null)

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-12-17T08:38:00Z
Last change time
2014-02-15T13:29:07Z
Keywords
spec
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla
Blocks
677

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2006-12-17T08:38:45Z
Under "Overloading == and !=" the spec claims that "if (a == null)" is converted to "if (a.opCmp(null))", when it is actually converted to "if (a.opEquals(null))". This has been reported a few times now, but left unfixed. Proof: the following program outputs "opEquals\nopEquals\nopCmp\n" and not "opCmp\nopEquals\nopCmp\n": class Foo { override int opEquals(Object o) { printf("opEquals\n"); return 0; } override int opCmp(Object o) { printf("opCmp\n"); return 0; } } void main() { Foo f = new Foo(); if (f == null) {} if (f.opEquals(null)) {} if (f.opCmp(null)) {} }
Comment #1 by smjg — 2007-01-03T19:52:27Z
Fixed 1.00
Comment #2 by bugzilla — 2007-01-03T22:05:08Z
Fixed DMD 1.00