[Issue 7512] Associative arrays implementation loses const and immutable in AA.get() and AA[key]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 27 20:12:53 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7512



--- Comment #6 from hsteoh at quickfur.ath.cx 2012-02-27 20:12:51 PST ---
Apparently AA.get() and AA[key] *always* computes the hash value based on the
unqualified type, whereas AA literals use the const type which computes a
different hash value. For example:

int[dstring] map = ["abc"d: 1];
assert(map["abc"d]==1); // throws range error
assert(("abc"d in map) !is null); // assertion fails
map["abc"d] = 1; // creates duplicated entry (foreach finds "abc"d:1 twice)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list