[Issue 7390] Problem in generating switch cases with a static foreach

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Apr 24 01:52:29 PDT 2017


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

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org

--- Comment #4 from Nick Treleaven <nick at geany.org> ---
(In reply to bearophile_hugs from comment #0)
>     switch (c) { // OK
>         foreach (X; xy) {
>             case X: break;
>         }
>         default: break;
>     }

The foreach break line above should error, this seems to be the bug. Still
present with 2.074.

>     switch (c) {
>         case 'z': break;
>         foreach (X; xy) {
>             case X: break;
>         }
>         default: break; // Error: switch case fallthrough
>     }
> }

This is correct.

--


More information about the Digitalmars-d-bugs mailing list