[Issue 23744] Bug/Edge case - Shorthand static if/foreach + case labels causes logical but unexpected behaviour

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 3 07:28:41 UTC 2023


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

--- Comment #4 from Bradley Chatha <bradley at chatha.dev> ---
Minimal reproduction:

```
void main()
{
    switch(0)
    {
        static if (false)
            case 0:
                int a;
                a = 0;
                break;

        default: break;
    }
}
```

I guess case labels also directly attach onto the next statement; which
explains some other behaviour I've seen (namely the attached statement being
omitted).

--


More information about the Digitalmars-d-bugs mailing list