Bug 3337 – weird behavior of associative arrays

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-09-21T19:59:00Z
Last change time
2015-06-09T01:26:47Z
Assigned to
nobody
Creator
rinick

Comments

Comment #0 by rinick — 2009-09-21T19:59:37Z
int[int[]] t; t[[1]] = 1; writeln(t); output: [[1245088]:1]
Comment #1 by dsimcha — 2009-09-21T21:37:01Z
Probably uninitialized memory or something. I'm also using 2.032, and using the following code: import std.stdio; void main() { int[int[]] t; t[[1]] = 1; writeln(t); } I get: [[14]:1] The point isn't the specific number, but the fact that the number is non-deterministic.
Comment #2 by dsimcha — 2009-09-21T21:38:26Z
Oh yeah, also notable is that this isn't just a bug in converting to string. The following code produces an access violation: import std.stdio; void main() { int[int[]] t; t[[1]] = 1; writeln(t[[1]]); }
Comment #3 by rinick — 2011-02-03T08:09:20Z
Seems this bug has already been fixed