https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100331
Michael Benfield <mbenfield at google dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mbenfield at google dot com --- Comment #2 from Michael Benfield <mbenfield at google dot com> --- Given code with unused variables/parameters of some struct type in C that warns for `-Wunused-variable`, the identical code warns in C++. But the same is not true of `-Wunused-but-set-variable`: code that warns in C will not warn in C++. This seems inconsistent to me; I suspect the code should warn in both languages. Similar comments apply to `-Wunused-parameter` and `-Wunused-but-set-parameter`. Given this code in both gcc-test.c and gcc-test.cpp: struct S { int x; }; void f_unused_but_set(struct S p1) { struct S s; p1 = s; struct S v1; v1 = s; } void f_unused(struct S p2) { struct S v2; } and compiling with `gcc -fsyntax-only -Wunused -Wextra gcc-test.c`, for gcc-test.c, we get warnings for all of p1, v1, p2, v2, while for gcc-test.cpp we get warnings only for p2 and v2.