https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107797

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:e3585e6acdfd5c1793f877476647d2521620c95c

commit r13-5314-ge3585e6acdfd5c1793f877476647d2521620c95c
Author: Marek Polacek <pola...@redhat.com>
Date:   Thu Jan 19 17:12:34 2023 -0500

    c++: Quash bogus -Wunused-value with new [PR107797]

    We shouldn't emit "right operand of comma operator has no effect"
    when that comma operator was created by the compiler for "new int{}".
    convert_to_void/COMPOUND_EXPR already checks warning_suppressed_p so
    we can just suppress -Wunused-value.

            PR c++/107797

    gcc/cp/ChangeLog:

            * cvt.cc (ocp_convert): copy_warning when creating a new
            COMPOUND_EXPR.
            * init.cc (build_new_1): Suppress -Wunused-value on
            compiler-generated COMPOUND_EXPRs.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Wunused-value-1.C: New test.

Reply via email to