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 #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.