Bug 12468 – Improve foreach type mismatch error message

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-25T12:41:11Z
Last change time
2022-08-22T13:17:35Z
Assigned to
No Owner
Creator
Jerry Quinn

Comments

Comment #0 by jlquinn — 2014-03-25T12:41:11Z
svm_node*[] SV; foreach (const ref p; SV[i]) { ... } DMD gives: Error: invalid foreach aggregate SV[cast(ulong)i] I had to stare at this for a bit to figure out what was going on. I would have been helped if DMD had reported the type of SV[cast(ulong)i] in the message.
Comment #1 by razvan.nitu1305 — 2022-08-22T13:17:35Z
This code now gives: test.d(5): Error: undefined identifier `i` Provided that the svn_node symbol exists. Closing as WORKSFORME.