[Issue 18712] [Reg 2.072] bogus "switch skips declaration" error with case in mixin

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 16 06:49:37 UTC 2018


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

--- Comment #7 from Rainer Schuetze <r.sagitario at gmx.de> ---
I just noticed that in this code:

int test(int n)
{
        switch(n)
        {
        case -1:
                int b = -1;
        mixin("case 0:");
                int x = 1;
                return x;
        case 1:
                int y = 2;
                return y;
        default:
                return -1;
        }
}

The scope of b extends until the end of `case 0`, too.

--


More information about the Digitalmars-d-bugs mailing list