Bug 10916 – toHash on VariantN not being recognised

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-28T04:21:00Z
Last change time
2014-07-04T16:57:54Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
public2

Comments

Comment #0 by public2 — 2013-08-28T04:21:47Z
Discussed at http://forum.dlang.org/thread/[email protected]. Apparently the toHash function in VariantN is not declared properly, leading it to ignored in favour of the default toHash for structs. Currently: size_t toHash() Should be: size_t toHash() const nothrow @safe As an example of what happens - assert(Variant("a") in assoc) can fail even if Variant("a") *is* a key of assoc.
Comment #1 by k.hara.pg — 2014-07-04T15:56:27Z
Comment #2 by github-bugzilla — 2014-07-04T16:57:53Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/6ba09e0c6da7f84fa575a81710c83ce21e0b9966 fix Issue 10916 - toHash on VariantN not being recognised Make VariantN.toHash() const nothrow @safe. Assume that `VariantN.type` property is @safe nothrow.