[Issue 16173] New: Implicit fall through is silently allowed

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 14 09:03:26 PDT 2016


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

          Issue ID: 16173
           Summary: Implicit fall through is silently allowed
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: 4burgos at gmail.com

```
import std.stdio;
import std.conv;
void main(string[] argv)
{
    int x = to!(int)(argv[1]);
    switch (x) {
        case 1:
            writeln("From 1");
        case 2:
            writeln("From 2");
            x = 3;
            break;
        case 3:
            x = 4;
        default:
            break;
    }

    writeln("x = ", x);
}
```
```
$ rdmd test.d 1
>From 1
>From 2
x = 3
```

--


More information about the Digitalmars-d-bugs mailing list