digitalmars.D.bugs - [Issue 19332] New: hashOf fails for const struct that has non-const
- d-bugmail puremagic.com (36/36) Oct 25 2018 https://issues.dlang.org/show_bug.cgi?id=19332
https://issues.dlang.org/show_bug.cgi?id=19332 Issue ID: 19332 Summary: hashOf fails for const struct that has non-const toHash & has all fields bitwise-hashable Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: n8sh.secondary hotmail.com Example: --- struct NotOkay { int canBitwiseHashInts; size_t toHash() /* not const */ { return 0; } } struct Okay { float cantBitwiseHashFloats; size_t toHash() /* not const */ { return 0; } } void main() { const okay = Okay.init; hashOf(okay); // Compiles but writes a message about the non-callable toHash. const notOkay = NotOkay.init; hashOf(notOkay); // Compilation fails! } --- --
Oct 25 2018