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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:124a9e08b7a83795bd4d09001955f0eef68ecd00

commit r13-1219-g124a9e08b7a83795bd4d09001955f0eef68ecd00
Author: Jason Merrill <ja...@redhat.com>
Date:   Thu Jun 23 00:24:22 2022 -0400

    c++: -Waddress and if constexpr [PR94554]

    Like we avoid various warnings for seemingly tautological expressions when
    substituting a template, we should avoid warning for the implicit
conversion
    to bool in an if statement.  I considered also doing this for the
conditions
    in loop expressions, but that seems unnecessary, as a loop condition is
    unlikely to be a constant.

    The change to finish_if_stmt_cond isn't necessary since dependent_operand_p
    looks through IMPLICIT_CONV_EXPR, but makes it more constent with
    e.g. build_x_binary_op that determines the type of an expression and then
    builds it using the original operands.

            PR c++/94554

    gcc/cp/ChangeLog:

            * pt.cc (dependent_operand_p): Split out from...
            (tsubst_copy_and_build): ...here.
            (tsubst_expr) [IF_STMT]: Use it.
            * semantics.cc (finish_if_stmt_cond): Keep the pre-conversion
            condition in the template tree.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/constexpr-if38.C: New test.

Reply via email to