[Issue 1727] Associate Array Literals regression

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 13 11:15:52 PST 2007


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


gide at nwawudu.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Comment #5 from gide at nwawudu.com  2007-12-13 13:15 -------
The following code compiles on both GDC and DMD, but DMD compiled code throws
an array bounds exception when executed. I think DMD might have a bug. 

test.d
------
import std.stdio;

void main() {
        int[char[]] aa =  ["aa":1, "bb":2, "cc":3]; // Fails
        //int[char[]] aa; aa =  ["aa":1, "bb":2, "cc":3]; // Fails 
        //int[char[]] aa; aa["aa"] = 1; aa["bb"] = 2; aa["cc"] = 3; // OK
        assert(aa.length == 3);
        assert(aa["aa"]==1); // Fails on DMD 2.008. Error: ArrayBoundsError
test(8)
        assert(aa["bb"]==2);
        assert(aa["cc"]==3);
        writefln(aa["aa"],aa["bb"],aa["cc"]); // On GDC outputs: 123
}


-- 



More information about the Digitalmars-d-bugs mailing list