[Issue 19087] New: `final switch` cannot be used in -betterC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 14 11:35:46 UTC 2018


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

          Issue ID: 19087
           Summary: `final switch` cannot be used in -betterC
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: slavo5150 at yahoo.com

void test(int p)
{
 final switch (p)
 {
   case 42:
     break;
 }
}

void main()
{
  test(0);
}

dmd -betterC test.d

/dlang/dmd/linux/bin64/../../src/druntime/import/core/exception.d(584): Error:
Cannot use throw statements with -betterC
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4180): Error:
template instance `core.exception.__switch_errorT!()` error instantiating

This is caused by a `throw` statement in the implementation of
`__switch_errorT` in druntime.  It should probably be an `assert`.

--


More information about the Digitalmars-d-bugs mailing list