www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18858] New: switch 'skips declaration' test only checks last


          Issue ID: 18858
           Summary: switch 'skips declaration' test only checks last
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com


  int test(int n)
    final switch(n)
        enum e = 6;
        int z = 5; // Error: switch skips declaration of variable test.z

        case 1:
            int y = 2;
            return y;

Good. Now reverse the enum e and int z statements, and no error will be

May 14 2018