[Issue 4739] New: Bad result retrieving 'char' keys in assoc array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 27 00:22:02 PDT 2010


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

           Summary: Bad result retrieving 'char' keys in assoc array
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: cbkbbejeap at mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap at mailinator.com> 2010-08-27 00:21:53 PDT ---
import std.stdio;

void main()
{
    auto aa = ['a':1, 'b':2, 'c':3];

    assert('a' in aa); // Ok
    assert('b' in aa); // Ok
    assert('c' in aa); // Ok

    // Expected:
    //   'a', 'b' and 'c' in any order
    // Actual:
    //   'a', '\0' and '\0'
    foreach(char ch; aa.keys)
        write(ch);
}

In my full program (ie, not this simplified test case), the first key is 'a'
(which is ok), the second is 'L' (should be 'b' or 'c'), and the third varies
depending on seemingly trivial and unrelated changes elsewhere. This would seem
to suggest a corrupted pointer somewhere, or maybe memory stomping.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list