Bug 11749 – switch case fallthrough error is enabled with -w, but cannot be made informational warning

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-15T06:10:00Z
Last change time
2013-12-15T09:15:55Z
Keywords
pull
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2013-12-15T06:10:13Z
This code from issue 9642 (slightly modified to also trigger the message with dmd 2.064): void main() { int x; switch ('x') { case 'a': x++; case 'b': x++; break; default: } } compiles without additional options, but reports error (not warning) with -w and -wi. >dmd fail9642.d && echo Success Success >dmd -w fail9642.d && echo Success fail9642.d(6): Error: switch case fallthrough - use 'goto case;' if intended >dmd -wi fail9642.d && echo Success fail9642.d(6): Error: switch case fallthrough - use 'goto case;' if intended Even with -wi compilation fails.
Comment #1 by r.sagitario — 2013-12-15T06:17:28Z
Comment #2 by bearophile_hugs — 2013-12-15T06:18:53Z
I don't understand this issue. Isn't switch case fallthrough is always an error in D?
Comment #3 by github-bugzilla — 2013-12-15T06:59:47Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f9111190ae1b38938a7b02676cc84a7b6e4ea1d2 Merge pull request #2965 from rainers/issue11749 fix Issue 11749 - switch case fallthrough error is enabled with -w, but cannot be made informational warning
Comment #4 by bearophile_hugs — 2013-12-15T08:03:13Z
This should be an error in every case, I think.
Comment #5 by r.sagitario — 2013-12-15T09:15:55Z
> This should be an error in every case, I think. I guess you are right. But that would probably mean that it needs to go through deprecation. The patch only tries to remove "D with informational warnings" from the set of languages with different semantics due to warnings.