Bug 9212 – Associative array foreach iteration with immutable key

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-26T15:02:00Z
Last change time
2013-11-23T09:03:06Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-12-26T15:02:57Z
I think this code should be accepted: void main() { int[int] aa; foreach (const key, val; aa) {} } DMD 2.061alpha gives: test.d(3): Error: foreach: index must be type int, not const(int)
Comment #1 by yebblies — 2013-11-23T06:20:11Z
Comment #2 by yebblies — 2013-11-23T08:11:34Z
*** Issue 9085 has been marked as a duplicate of this issue. ***
Comment #3 by github-bugzilla — 2013-11-23T08:50:36Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/05d96adbdfce0aa9006a20db0b57ddd002323cd9 Fix Issue 9212 - Associative array foreach iteration with immutable key https://github.com/D-Programming-Language/dmd/commit/305b808a8808a07f1f78a7ab4ec0312ff2060dc2 Merge pull request #2864 from yebblies/issue9212 Issue 9212 - Associative array foreach iteration with immutable key