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 <jason@redhat.com>