[Issue 13031] New: `continue` with label causes compiler to think code after loop can be executed

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 3 04:20:16 PDT 2014


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 at puremagic.com
          Reporter: verylonglogin.reg at 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
---

--


More information about the Digitalmars-d-bugs mailing list