www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - is this a bug? (aa initializer)

reply Lutger <lutger.blijdestijn gmail.com> writes:
With dmd 2.017:

import std.stdio;

void main()
{
    string[string] foobar =  [ "foo" : "bar" ];
       foreach (key, value; foobar)
           writefln(key, value); // prints foobar
    assert(foobar["foo"] == "bar"); // arraybounds error
}

Could somebody verify this as a bug or not? I'm not sure because I just
started with D2 a bit. 
Aug 03 2008
parent "Koroskin Denis" <2korden gmail.com> writes:
On Sun, 03 Aug 2008 16:40:08 +0400, Lutger <lutger.blijdestijn gmail.com=
  =
wrote:
 With dmd 2.017:

 import std.stdio;

 void main()
 {
     string[string] foobar =3D  [ "foo" : "bar" ];
        foreach (key, value; foobar)
            writefln(key, value); // prints foobar
     assert(foobar["foo"] =3D=3D "bar"); // arraybounds error
 }

 Could somebody verify this as a bug or not? I'm not sure because I jus=
t
 started with D2 a bit.
It is, I think. The following: import std.stdio; void main() { string[string] aa =3D [ "foo" : "bar"]; aa["foo"] =3D "baz"; = foreach (key, value; aa) writefln(key, " - ", value); // prints foobar } Outputs: foo - bar foo - baz D1 output: foo - baz Could you put it into bugzilla, please?
Aug 03 2008