Bug 6775 – [CTFE] foreach over an AA fails to compile

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-10-05T22:40:00Z
Last change time
2015-06-09T05:11:40Z
Keywords
rejects-valid
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2011-10-05T22:40:40Z
..because aaApply and aaApply2 aren't implemented. Simple test case: static assert({ int[int] aa = [58: 17, 45:6]; int valsum = 0; int keysum = 0; foreach(m; aa) { //aaApply valsum += m; } assert(valsum == 17+6); valsum = 0; foreach(n, m; aa) { //aaApply2 valsum += m; keysum += n; } assert(valsum == 17+6); assert(keysum == 58+45); // Check empty AA valsum = 0; int[int] bb; foreach(m; bb) { ++valsum; } assert(valsum == 0); return true; }());
Comment #1 by bugzilla — 2011-10-06T23:30:08Z