[Issue 17853] New: Switch statement without braces only works with one case

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 23 12:21:23 UTC 2017


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

          Issue ID: 17853
           Summary: Switch statement without braces only works with one
                    case
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

i.e:
---
int main()
{
  int ob = 0;

  final switch (ob++)
    case 0: case 1:
        break;

  return ob;
}
---

Gives the error: 'function D main no return exp; or assert(0); at end of
function'

Remove one of the cases, and it compiles.

--


More information about the Digitalmars-d-bugs mailing list