[Issue 3967] bool opEquals() for structs instead of int opEquals()
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 7 04:42:37 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3967
--- Comment #4 from Lutger <lutger.blijdestijn at gmail.com> 2010-08-07 04:42:33 PDT ---
Something else is going on, the following does fail in line with your proposal:
import std.c.stdio: printf;
struct Foo {
int data;
int opEquals(ref const(Foo) other) const
{
printf("A");
return this.data == other.data;
}
}
void main() {
int r = Foo(5) == Foo(5);
}
output: Error: function test.Foo.opEquals type signature should be const
bool(ref const(Foo)) not const int(ref const(Foo) other)
Changing opEquals to return bool makes it compile correctly.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list