[Issue 2954] New: Appaling bug in associative arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 8 15:38:13 PDT 2009


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

           Summary: Appaling bug in associative arrays
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: andrei at metalanguage.com


This program compiles and prints "Abc":

import std.stdio; 

void main() {
    uint[string] hash;
    char[] a = "abc".dup;
    hash[a] = 42;
    a[0] = 'A';
    writeln(hash.keys);
}

It should not compile because char[] is obviously not convertible to string. By
this I am also reiterating the necessity to make associative arrays a true
library type and have the compiler rewrite the literals and the type name to
use that library type.


-- 



More information about the Digitalmars-d-bugs mailing list