Bug 6210 – Associative array with array key often cannot be equated.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-06-24T13:31:00Z
Last change time
2013-08-15T09:48:41Z
Keywords
pull
Assigned to
nobody
Creator
kennytm

Comments

Comment #0 by kennytm — 2011-06-24T13:31:30Z
Test case 1: ---------------------------------------- void main() { int[char[]] a; a["h"] = 1; assert(a == a.dup); // <-- asserts } ---------------------------------------- Test case 2: ---------------------------------------- void main() { int[immutable(int)[]] a, b; a[[1].idup] = 1; b[[1].idup] = 1; assert(a == b); // <-- asserts } ----------------------------------------
Comment #1 by hsteoh — 2012-03-02T19:29:48Z
Comment #2 by hsteoh — 2012-12-17T13:43:42Z
Hmm, the pull request fixed test case 2, but test case 1 is still failing.
Comment #3 by hsteoh — 2013-08-13T10:30:34Z
Argh, this is caused by the stupidity of typeid(const(char)[]) using a different hash function from typeid(char[]) and typeid(immutable(char)[]). Will submit a pull for this.
Comment #4 by hsteoh — 2013-08-15T07:54:52Z
Comment #5 by github-bugzilla — 2013-08-15T09:31:29Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/b8b4726a5e9d4781c3822a483abb66e8952323a8 Subsidiary fix for issue 6210. Add builtin typeinfo for const(char)[] so that it will use the same hash function as char[] and string. https://github.com/D-Programming-Language/druntime/commit/8aa3ebf8715fc6c49bedd2c0c18b92e6ed46b045 Merge pull request #573 from quickfur/issue6210 Subsidiary fix for issue 6210.
Comment #6 by github-bugzilla — 2013-08-15T09:31:31Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/3e811df8a9d1839282254d403fb9129f162fbe6f Merge pull request #2479 from quickfur/issue6210 Fix issue 6210
Comment #7 by hsteoh — 2013-08-15T09:48:41Z
Verified fixed.