Bug 4739 – Bad result retrieving 'char' keys in assoc array

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-08-27T00:21:00Z
Last change time
2010-08-27T07:23:12Z
Keywords
wrong-code
Assigned to
nobody
Creator
bus_dbugzilla

Comments

Comment #0 by bus_dbugzilla — 2010-08-27T00:21:53Z
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.
Comment #1 by schveiguy — 2010-08-27T07:23:12Z
*** This issue has been marked as a duplicate of issue 4201 ***