https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126924
Bug ID: 126924
Summary: Wimplicit-fallthrough not issued if next case only
contains a break
Product: gcc
Version: 16.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: headch at gmail dot com
Target Milestone: ---
This code does not generate a Wimplicit-fallthrough warning:
void g();
void f(int x) {
switch(x) {
case 1:
g();
case 2:
//g();
break;
}
}
It does if you uncomment the commented-out line. It seems to me that it should
generate a Wimplicit-fallthrough warning either way—my understanding is that
the intention is to not generate the warning if the case you are falling *from*
is empty (so you can group case labels together that all have the same
handling), not if the case you are falling *into* is empty (which seems like
nothing special, and ought to be warned about).