https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103597
Bug ID: 103597 Summary: False -Wimplicit-fallthrough= involving macro Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sbergman at redhat dot com Target Milestone: --- I think this is a recent regression on GCC 12 trunk (I'm at basepoints/gcc-12-5818-g30a08286e67; it doesn't happen with e.g. gcc-c++-11.2.1-1.fc35.x86_64): > $ cat test.cc > #define E(c, e) if (c) e > int f(int n) { > switch (n) { > case 0: > E(true, return 0); > case 1: > return 1; > } > return 2; > } > $ g++ -c -Wimplicit-fallthrough test.cc > test.cc: In function ‘int f(int)’: > test.cc:1:17: warning: this statement may fall through > [-Wimplicit-fallthrough=] > 1 | #define E(c, e) if (c) e > | ^~ > test.cc:5:9: note: in expansion of macro ‘E’ > 5 | E(true, return 0); > | ^ > test.cc:6:5: note: here > 6 | case 1: > | ^~~~