[Issue 20827] New: Spurious "has no `return` statement, but is expected to return a value" with labeled continue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 12 21:44:53 UTC 2020


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

          Issue ID: 20827
           Summary: Spurious "has no `return` statement, but is expected
                    to return a value" with labeled continue
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P4
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dlang-bugzilla at thecybershadow.net

///////// test.d /////////
int fun()
{
    while (true)
    {
    loop:
        foreach (n; 0..10)
            continue loop;
    }
}
//////////////////////////

DMD says:
Error: function `test.fun` has no `return` statement, but is expected to return
a value of type `int`

--


More information about the Digitalmars-d-bugs mailing list