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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:45c949fb697d4602fa8ce8e87213cf17e1acf60b

commit r14-11596-g45c949fb697d4602fa8ce8e87213cf17e1acf60b
Author: Jason Merrill <ja...@redhat.com>
Date:   Thu Apr 10 18:16:37 2025 -0400

    c++: avoid ARM -Wunused-value [PR114970]

    Because of the __builtin_is_constant_evaluated, maybe_constant_init in
    expand_default_init fails, so the constexpr constructor isn't folded until
    cp_fold, which builds a COMPOUND_EXPR in case the enclosing expression is
    relying on the ARM behavior of returning 'this'.

    As in other places, avoid -Wunused-value on artificial COMPOUND_EXPR.

            PR c++/114970

    gcc/cp/ChangeLog:

            * cp-gimplify.cc (cp_fold): Suppress warnings on
            return_this COMPOUND_EXPR.

    gcc/testsuite/ChangeLog:

            * g++.dg/opt/is_constant_evaluated4.C: New test.

    (cherry picked from commit 4acdfb71d4fdaa43c2707ad7b2fb7b2b7bddfc42)

Reply via email to