https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91335
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Resolution|--- |INVALID --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- Declaring the variable with attribute unused (or [[maybe_unused]]) is the intended mechanism to suppress the warning when the variable is meant to be declared but not otherwise referenced: int main() { if (int *f __attribute__ ((unused)) = foo()) return 1; } I agree that the warning for the test case is not just by design but desirable, and since there are several straightforward solutions I think this report should be resolved invalid.