www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13031] New: `continue` with label causes compiler to think

https://issues.dlang.org/show_bug.cgi?id=13031

          Issue ID: 13031
           Summary: `continue` with label causes compiler to think code
                    after loop can be executed
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: verylonglogin.reg gmail.com

This code should compile:
---
int f(int a)
{
L:  for(;;)
    {
        if(a--)
            continue L;
        return 0;
    }
}
---
main.d(1): Error: function main.f no return exp; or assert(0); at end of
function
---

--
Jul 03 2014