Thread overview
[Issue 694] New: Doc mistake: a == null is not a.opCmp(null)
Dec 17, 2006
d-bugmail
Jan 04, 2007
d-bugmail
Jan 04, 2007
d-bugmail
December 17, 2006
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)) {}
}


-- 

January 04, 2007
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




------- Comment #1 from smjg@iname.com  2007-01-03 19:52 -------
Fixed 1.00


-- 

January 04, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=694





------- Comment #2 from bugzilla@digitalmars.com  2007-01-03 22:05 -------
Fixed DMD 1.00


--