D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4739 - Bad result retrieving 'char' keys in assoc array
Summary: Bad result retrieving 'char' keys in assoc array
Status: RESOLVED DUPLICATE of issue 4201
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2010-08-27 00:21 UTC by Nick Sabalausky
Modified: 2010-08-27 07:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nick Sabalausky 2010-08-27 00:21:53 UTC
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 Steven Schveighoffer 2010-08-27 07:23:12 UTC

*** This issue has been marked as a duplicate of issue 4201 ***