Bug 17853 – Switch statement without braces only works with one case
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-09-23T12:21:23Z
Last change time
2017-12-18T22:54:47Z
Keywords
rejects-valid
Assigned to
Lucia Cojocaru
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2017-09-23T12:21:23Z
i.e:
---
int main()
{
int ob = 0;
final switch (ob++)
case 0: case 1:
break;
return ob;
}
---
Gives the error: 'function D main no return exp; or assert(0); at end of function'
Remove one of the cases, and it compiles.
Comment #1 by github-bugzilla — 2017-10-16T19:14:57Z