https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114104
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:144b6099cdaa9ac1b298687c0cfdb06a970e338b commit r15-2118-g144b6099cdaa9ac1b298687c0cfdb06a970e338b Author: Patrick Palka <ppa...@redhat.com> Date: Wed Jul 17 20:57:54 2024 -0400 c++: missing -Wunused-value for !<expr> [PR114104] Here we're neglecting to issue a -Wunused-value warning for suitable ! operator expressions, and in turn for != operator expressions that are rewritten as !(x == y), only because we don't call warn_if_unused_value on TRUTH_NOT_EXPR since its class is tcc_expression. This patch makes us also consider warning for TRUTH_NOT_EXPR and also for ADDR_EXPR. PR c++/114104 gcc/cp/ChangeLog: * cvt.cc (convert_to_void): Call warn_if_unused_value for TRUTH_NOT_EXPR and ADDR_EXPR as well. gcc/testsuite/ChangeLog: * g++.dg/warn/Wunused-20.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com>