Bug 22406 – importC: Error: 'switch' statement without a 'default'; use 'final switch' or add 'default: assert(0);' or add 'default: break;'
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-10-17T13:52:44Z
Last change time
2021-10-21T21:39:36Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2021-10-17T13:52:44Z
I guess SwitchStatements are not handled at all by importC semantics.
---
void f1()
{
switch (1)
{
case 1:
break;
}
}
---
Also, the compiler emits:
---
Error: `object` is not a member of `void`
Comment #1 by dlang-bot — 2021-10-17T17:46:39Z
@ibuclaw created dlang/dmd pull request #13187 "fix Issue 22406 - importC: Error: 'switch' statement without a 'default'; use 'final switch' or add 'default: assert(0);' or add 'default: break;'" fixing this issue:
- fix Issue 22406 - importC: Error: 'switch' statement without a 'default'; use 'final switch' or add 'default: assert(0);' or add 'default: break;'
https://github.com/dlang/dmd/pull/13187
Comment #2 by dlang-bot — 2021-10-18T00:19:16Z
dlang/dmd pull request #13187 "fix Issue 22406 - importC: Error: 'switch' statement without a 'default'; use 'final switch' or add 'default: assert(0);' or add 'default: break;'" was merged into stable:
- ec3fb8db4a213f3b19fe13804904d3782cdb412d by Iain Buclaw:
fix Issue 22406 - importC: Error: 'switch' statement without a 'default'; use 'final switch' or add 'default: assert(0);' or add 'default: break;'
https://github.com/dlang/dmd/pull/13187
Comment #3 by dlang-bot — 2021-10-21T21:39:36Z
dlang/dmd pull request #13209 "Merge stable into master" was merged into master:
- f60ea8d142081919cab615aa49ee11c6919c2a6f by Iain Buclaw:
fix Issue 22406 - importC: Error: 'switch' statement without a 'default'; use 'final switch' or add 'default: assert(0);' or add 'default: break;'
https://github.com/dlang/dmd/pull/13209