July 14, 2018 [Issue 19087] New: `final switch` cannot be used in -betterC | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: slavo5150@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`. -- |
Copyright © 1999-2021 by the D Language Foundation