Summary: Setting new key for Associative Array of Static Array
                    causes RangeError
           Product: D
           Version: 2.025
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P3
         Component: DMD

string[2][string] hash;

// All assignment expressions listed below are compiled without any error nor
// and throw runtime RangeError.
hash["key"] = ["a","b"]; 
hash["key"] = new string[2];
hash["key"] = null;
hash["key"] = "";
hash["key"] = [0,0]; 
hash["key"][0] = "";

assert(typeid(typeof(hash["key"])) == typeid(typeof(["a","b"])) );

On the other hand, Associative Array of Dynamic Array works well.

string[][string] hash;
hash["key"] = ["a", "b"];
writefln( hash["key"] ); 

occurs in both D1/D2.


Reply via email to