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: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@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: -------