digitalmars.D.bugs - [Issue 958] New: opEquals and opCmp doesn't take Object anymore
- d-bugmail puremagic.com (30/30) Feb 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=958
- d-bugmail puremagic.com (10/10) Feb 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=958
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.
--
Feb 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=958
torhu yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
Nevermind. I used 'bool opCmp(Object)' instead of 'int opCmp(Object)'. How
embarrassing.
--
Feb 13 2007








d-bugmail puremagic.com