Bug 3394 – enum + for loop = strange errors

Status
RESOLVED
Resolution
DUPLICATE
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-10-13T09:10:00Z
Last change time
2015-06-09T01:28:30Z
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2009-10-13T09:10:38Z
enum FOO = 2; void main() { for(uint i = 0; i < 2; i += FOO) {} } Results in a compile time error: test.d(4): Error: variable FOO used before set Marking as minor because it appears to be an extremely weird corner case bug. The only place I could reproduce it was when the enum is used in a for loop like the above. Also, changing FOO from enum to immutable resolves this.
Comment #1 by clugdbug — 2009-10-13T09:12:18Z
Already patched. *** This issue has been marked as a duplicate of issue 3190 ***