www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17853] New: Switch statement without braces only works with

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 puremagic.com
          Reporter: ibuclaw 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.

--
Sep 23