www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2265] New: AA initializer with string as key is bugged

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2265

           Summary: AA initializer with string as key is bugged
           Product: D
           Version: 2.000
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: lutger.blijdestijn gmail.com


Initializing an associative array with strings as key doesn't work correctly in
D2, see the following program:

import std.stdio;

void main()
{
    string[string] aa = [ "foo" : "bar"];
    aa["foo"] = "baz";
    foreach (key, value; aa)
        writefln(key, " - ", value);
}

Ouput is: 
foo - bar
foo - baz

This happens only with strings as the key type and only in D2


-- 
Aug 03 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2265


lutger.blijdestijn gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lutger.blijdestijn gmail.com
           Keywords|wrong-code                  |accepts-invalid, diagnostic




------- Comment #1 from lutger.blijdestijn gmail.com  2008-08-13 03:45 -------
I'm sorry, this bug report was wrong. According to the spec, aa literals cannot
be used to statically initialize anything. Now the issue is still that dmd
should report this as an error. 

This also holds for D1 where no error is reported.


-- 
Aug 13 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2265


gide nwawudu.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




------- Comment #2 from gide nwawudu.com  2008-11-18 18:43 -------


*** This bug has been marked as a duplicate of 2333 ***


-- 
Nov 18 2008