https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
--- Comment #33 from costinc at gmail dot com --- There are legitimate reasons to ignore results, even without additional comments. One use case I ran into is: // ok() checks the same condition as the one returned by f(). while (ok()) { switch (...) { case 1: (void)f(1); case 2: (void)f(2); ... } } I don't think it's necessary to comment on every single call to f(). At some point people might start using if (f()){} on all function calls where they don't use the result, because that works and casting to void doesn't anymore because of this issue. The way to prevent that might be to start warning on that too. What if a static analysis tool decides to warn on if (f()){}? How do you please both gcc and the tool? if ((void)f()){}? Thankfully this is a highly unlikely scenario as it doesn't seem like other compilers/tools have their own unique ideas here. It seems the reason to warn even when using (void) is to implement a ticket system. First, use (void). This will grant you a ticket to ignore results. At some point we'll get angry and decide not to let you do this anymore because you've abused it. Then, use if(f()){}. This will grant you a different ticket so you can have a way to ignore results for a while longer. Then use the next thing. At least now there is [[nodiscard]] and casting to void is quite clearly defined in the standard. But thanks to the present issue it's not quite the portable way to ignore results (some libraries will use nodiscard, others will use WUR).