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
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/a629ebf9973c0860b20ecf9ba8791d74730f071b fix issue 17853 https://github.com/dlang/dmd/commit/f78b548887321814ed80e6d55b47e9901502b415 Merge pull request #7203 from somzzz/switchCaseCascade fix issue 17853 - Switch statement without braces only works with one case merged-on-behalf-of: Andrei Alexandrescu <[email protected]>
Comment #2 by github-bugzilla — 2017-12-18T22:54:47Z