[Bug c/83955] false positive implicit-fallthrough warning on switch enum
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jan 26 23:02:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83955
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-01-26
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Without -Wswitch-default GCC doesn't warn for case statements that have labels
for all values of the enumerated controlling expression. I.e., the assumption
is that the controlling expression's value matches one of the enumerators.
Having -Wimplicit-fallthrough warn for such a case statement would run counter
to that philosophy. I think -Wimplicit-fallthrough should do what GCC does
without -Wswitch-default and assume that a case statement that transfers
control out of all labels for all of its controlling expression's enumerators
does not fall through.
With that I will confirm this report as a bug.
More information about the Gcc-bugs
mailing list