[Issue 958] New: opEquals and opCmp doesn't take Object anymore
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 13 06:50:00 PST 2007
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 at digitalmars.com
ReportedBy: torhu at 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.
--
More information about the Digitalmars-d-bugs
mailing list