www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19087] New: `final switch` cannot be used in -betterC


          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 puremagic.com
          Reporter: slavo5150 yahoo.com

void test(int p)
 final switch (p)
   case 42:

void main()

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`.

Jul 14 2018