February 24, 2010 [Issue 3844] New: Require opEquals/opCmp in a class the defines toHash | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3844 Summary: Require opEquals/opCmp in a class the defines toHash Product: D Version: 2.040 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2010-02-23 17:38:34 PST --- This code compiles and runs: class Foo { int a, b; override hash_t toHash() { return a + b; } this(int aa, int bb) { this.a = aa; this.b = bb; } } void main() { int[Foo] aa1; aa1[new Foo(1, 2)] = 10; } I think in a class it's not that useful to define toHash and not define opEquals/opCmp too. So when a toHash is defined, the compiler can raise a warning to require the definition of an opEquals/opCmp too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 06, 2010 [Issue 3844] Require opEquals/opCmp in a class the defines toHash | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=3844 --- Comment #1 from bearophile_hugs@eml.cc 2010-06-06 13:09:51 PDT --- See also bug 4290 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation