digitalmars.D.bugs - [Issue 16654] New: hashOf returns different hashes for the same
- via Digitalmars-d-bugs (26/26) Nov 01 2016 https://issues.dlang.org/show_bug.cgi?id=16654
https://issues.dlang.org/show_bug.cgi?id=16654 Issue ID: 16654 Summary: hashOf returns different hashes for the same string value Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: dev nomad.so The following assert fails: import std.stdio; import std.conv; void main(string[] args) { auto x = 1; assert(hashOf(x.to!(string)) == hashOf(x.to!(string))); } This is because numeric values of the pointers to the strings are being included in the hash calculation. Discussion: http://forum.dlang.org/post/gdtaqdooaknhsmcowgxs forum.dlang.org --
Nov 01 2016