digitalmars.D.bugs - [Issue 694] New: Doc mistake: a == null is not a.opCmp(null)
- d-bugmail puremagic.com (38/38) Dec 17 2006 http://d.puremagic.com/issues/show_bug.cgi?id=694
- d-bugmail puremagic.com (10/10) Jan 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=694
- d-bugmail puremagic.com (4/4) Jan 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=694
http://d.puremagic.com/issues/show_bug.cgi?id=694
Summary: Doc mistake: a == null is not a.opCmp(null)
Product: D
Version: 0.177
Platform: All
URL: http://www.digitalmars.com/d/operatoroverloading.html
OS/Version: All
Status: NEW
Keywords: spec
Severity: normal
Priority: P2
Component: www.digitalmars.com
AssignedTo: bugzilla digitalmars.com
ReportedBy: deewiant gmail.com
OtherBugsDependingO 677
nThis:
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)) {}
}
--
Dec 17 2006
http://d.puremagic.com/issues/show_bug.cgi?id=694
smjg iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg iname.com
Status|NEW |RESOLVED
Resolution| |FIXED
Fixed 1.00
--
Jan 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=694 Fixed DMD 1.00 --
Jan 03 2007









d-bugmail puremagic.com 