Bug 7704 – RangeError when using key optainey by AA byKey() iteration
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-13T16:05:00Z
Last change time
2012-06-24T21:04:51Z
Assigned to
nobody
Creator
tobias
Comments
Comment #0 by tobias — 2012-03-13T16:05:57Z
I get this error:
tobias@akela-buntschuh:~/projects/neo$ ./test
core.exception.RangeError@test(18): Range violation
----------------
./test(_d_array_bounds+0x2a) [0x447c82]
./test() [0x4440c6]
./test(void test.main().int __foreachbody1285(ref immutable(dchar)[])+0x5c) [0x4435a8]
./test(int delegate(int delegate(ref immutable(dchar)[])) object.AssociativeArray!(immutable(dchar)[], int).AssociativeArray.byKey().int foo(int delegate(ref immutable(dchar)[])).int byKeydg(ref immutable(dchar)[], ref int)+0x24) [0x443894]
./test(_aaApply2+0x74) [0x4471e4]
./test(int delegate(int delegate(ref immutable(dchar)[])) object.AssociativeArray!(immutable(dchar)[], int).AssociativeArray.byKey().int foo(int delegate(ref immutable(dchar)[]))+0x54) [0x443868]
./test(_Dmain+0x3c) [0x443540]
./test(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x17) [0x448227]
./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x447dce]
./test(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x42) [0x44827a]
./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x447dce]
./test(main+0xd3) [0x447d5f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7fa6018ca30d]
when running the attached program with DMD 2.57
int[dstring] aa;
static this()
{
aa = [
"+"d : 1,
"/"d : 2,
"-"d : 3,
"*"d : 4
];
}
void main()
{
foreach(key; aa.byKey())
writeln(aa[key]);
}
Comment #1 by hsteoh — 2012-03-13T22:09:06Z
This appears to be the same as bug 7512, which has been fixed in git.
Comment #2 by hsteoh — 2012-04-17T08:18:16Z
Now that 2.059 is out, could you re-test this bug to see if it has been fixed? I believe what you're seeing is the same as bug 7512, which has been fixed. Thanks!