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)