Bug 16254 – [REG 2.072-devel] wrong switch skips initialization error with mixed in case labels

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-08T20:29:00Z
Last change time
2016-10-01T11:48:19Z
Keywords
rejects-valid
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2016-07-08T20:29:30Z
cat > bug.d << CODE bool bug(int val) { switch (val) { mixin("case 0:"); auto v = 0; return true; default: return false; } } CODE dmd -c bug ---- bug.d(3): Error: 'switch' skips declaration of variable bug.bug.v at bug.d(6) ---- I'd guess something in the semantic order changed since 2.071.1.
Comment #1 by github-bugzilla — 2016-07-08T22:50:09Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/fdf70df83495542b9829a2853d0b1c6ee58d83ea fix Issue 16254 - switch skips initialization error - replace intended diagnostic error with deprecation - checks should be improved to detect actual variable usage https://github.com/dlang/dmd/commit/a9b56bad42d6abf03fe5aa894c105733197dec0c Merge pull request #5922 from MartinNowak/fix16254 fix Issue 16254 - switch skips initialization error
Comment #2 by github-bugzilla — 2016-10-01T11:48:19Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/fdf70df83495542b9829a2853d0b1c6ee58d83ea fix Issue 16254 - switch skips initialization error https://github.com/dlang/dmd/commit/a9b56bad42d6abf03fe5aa894c105733197dec0c Merge pull request #5922 from MartinNowak/fix16254