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

--- Comment #4 from CVS 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:ab71d3fe4b23af4c29a8d6fcf1e914fed4393e3b

commit r12-7630-gab71d3fe4b23af4c29a8d6fcf1e914fed4393e3b
Author: Patrick Palka <ppa...@redhat.com>
Date:   Sat Mar 12 14:57:59 2022 -0500

    c++: ICE with non-constant satisfaction value [PR98644]

    Here during satisfaction, the expression of the atomic constraint after
    substitution is (int *) NON_LVALUE_EXPR <1> != 0B, which is not a C++
    constant expression due to the reinterpret_cast, but TREE_CONSTANT is
    set since its value is otherwise effectively constant.  We then call
    maybe_constant_value on it, which proceeds via its fail-fast path to
    exit early without clearing TREE_CONSTANT.  But satisfy_atom relies
    on checking TREE_CONSTANT of the result of maybe_constant_value in order
    to detect non-constant satisfaction.

    This patch fixes this by making the fail-fast path of maybe_constant_value
    clear TREE_CONSTANT in this case, like cxx_eval_outermost_constant_expr
    in the normal path would have done.

            PR c++/98644

    gcc/cp/ChangeLog:

            * constexpr.cc (mark_non_constant): Define, split out from ...
            (cxx_eval_outermost_constant_expr): ... here.
            (maybe_constant_value): Use it.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-pr98644.C: New test.
            * g++.dg/parse/array-size2.C: Remove expected diagnostic about a
            narrowing conversion.

    Co-authored-by: Jason Merrill <ja...@redhat.com>

Reply via email to