https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121950
Bug ID: 121950
Summary: -Wimplicit-fallthrough doesn't warn on bugs if there
are declarations with vacuous initializations and
non-trivial destructors
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
struct S { int a, b, c; ~S (); };
int i;
void
foo (int x)
{
switch (x)
{
case 1:
S s1;
++i;
case 2:
S s2;
++i;
// FALLTHRU
case 3:
S s3;
++i;
[[fallthrough]];
default:
S s4;
++i;
break;
}
}
doesn't warn about implicit fallthrough unless ~S (); is commented out.