[Issue 7512] Associative arrays with dstring as key do not work correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 27 14:01:55 PST 2012


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



--- Comment #4 from hsteoh at quickfur.ath.cx 2012-02-27 14:01:53 PST ---
Direct proof that something really weird is going on:

const int[] key1 = [1,3,5];
const int[] key2 = [2,4,6];
int[int[]] a8 = [ key1: 135, key2: 246 ];
a8[key1] = 135; // you'd think this should have no effect
foreach (key, val; a8) {
    // But you'd be wrong...
    writeln("%s -> %s", key, val);
}

// OUTPUT:
[2, 4, 6] -> 246
[1, 3, 5] -> 135
[1, 3, 5] -> 135

(Note the duplicated identical key->value pair.)

So the key/value pair initialized by the AA literal is somehow "different" from
the key/value pair assigned by "a8[key]=value;".

-- 
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