[Issue 15485] New: switch with no case compiles

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Dec 30 23:54:40 PST 2015


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

          Issue ID: 15485
           Summary: switch with no case compiles
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: alex at sunopti.com

The below code compiles, but fails at run time with "No appropriate switch
clause found".
This could be made a compiler error.


void main()
{
    int x = 10;
    switch (x)
    {
        if (x == 10)
        {
            return;
        }
    }
}

--


More information about the Digitalmars-d-bugs mailing list