[Issue 7894] New: [CTFE] - goto within ForStatement restarts loop

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 12 15:24:21 PDT 2012


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

           Summary: [CTFE] - goto within ForStatement restarts loop
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dawg at dawgfoto.de


--- Comment #0 from dawg at dawgfoto.de 2012-04-12 15:25:07 PDT ---
cat > bug.d << CODE
int foo()
{
    foreach(v; 0 .. 2)
    {
        auto n = v;
    Lagain:
        if (n--) goto Lagain;
    }
    return 0;
}

enum ctfe = foo();
CODE

dmd -c bug.d

--------

This will loop endlessly because the loop initializer is
reinterpreted after each goto.

-- 
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