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

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

Consider:

  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
generated.

--

Reply via email to