February 13, 2007 [Issue 958] New: opEquals and opCmp doesn't take Object anymore | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=958 Summary: opEquals and opCmp doesn't take Object anymore Product: D Version: 1.005 Platform: PC URL: http://www.digitalmars.com/d/operatoroverloading.html OS/Version: Windows Status: NEW Keywords: spec Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: torhu@yahoo.com 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. -- |
February 13, 2007 [Issue 958] opEquals and opCmp doesn't take Object anymore | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=958 torhu@yahoo.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #1 from torhu@yahoo.com 2007-02-13 08:56 ------- Nevermind. I used 'bool opCmp(Object)' instead of 'int opCmp(Object)'. How embarrassing. -- |
Copyright © 1999-2021 by the D Language Foundation