Bug 7371 – Associative arrays as associative array keys

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-01-26T04:52:00Z
Last change time
2012-12-17T13:45:25Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-01-26T04:52:07Z
D2 code: import std.stdio; alias bool[int] IntSet; void main() { int[IntSet] aa; aa[[1:true, 2:true]] = true; IntSet is1 = [1:true]; is1[2] = true; aa[is1] = 2; writeln(aa); } Output: [[1:true, 2:true]:1, [1:true, 2:true]:2] Expected output: [[1:true, 2:true]:2] This bug is almost "major". Related to bug 3789 ?
Comment #1 by hsteoh — 2012-02-29T11:21:06Z
This bug is caused by the hash value being wrongly computed when an AA literal is used (cf bug 7512 -- unfortunately the fix for that doesn't fix this issue; probably another bug in another override of getHash).
Comment #2 by hsteoh — 2012-03-02T19:29:09Z
Comment #3 by hsteoh — 2012-12-17T13:45:25Z
Fixed in git HEAD.