www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3394] New: enum + for loop = strange errors

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha 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: -------
Oct 13 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3394


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |DUPLICATE


--- Comment #1 from Don <clugdbug yahoo.com.au> 2009-10-13 09:12:18 PDT ---
Already patched.

*** This issue has been marked as a duplicate of issue 3190 ***

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