[Issue 3394] New: enum + for loop = strange errors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 13 09:10:39 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3394

           Summary: enum + for loop = strange errors
           Product: D
           Version: 2.034
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2009-10-13 09:10:38 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list