On Thu, Dec 12, 2024 at 3:29 PM Patrick Palka <ppa...@redhat.com> wrote:
>
> Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look
> OK for trunk and perhpas 14?

Ping.

>
> -- >8 --
>
> When we encounter an unexpected (likely templated) tree code during
> constexpr evaluation we currently ICE even in release mode.  But it
> seems more user-friendly to just gracefully treat the expression as
> non-constant, which will be harmless most of the time (e.g. in the case
> of warning-specific or speculative constexpr folding as in the PR), and
> at worst would transform an ICE-on-valid bug into a rejects-valid bug.
> This is also what e.g. tsubst_expr does when it encounters an unexpected
> (likely non-templated) tree code.
>
>         PR c++/117925
>
> gcc/cp/ChangeLog:
>
>         * constexpr.cc (cxx_eval_constant_expression) <default>:
>         Relax ICE when encountering an unexpected tree code into a
>         checking ICE guarded by flag_checking.
> ---
>  gcc/cp/constexpr.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
> index 55e44fcbafb..221d57f6ffa 100644
> --- a/gcc/cp/constexpr.cc
> +++ b/gcc/cp/constexpr.cc
> @@ -8613,7 +8613,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, 
> tree t,
>             error_at (EXPR_LOCATION (t),
>                       "statement is not a constant expression");
>         }
> -      else
> +      else if (flag_checking)
>         internal_error ("unexpected expression %qE of kind %s", t,
>                         get_tree_code_name (TREE_CODE (t)));
>        *non_constant_p = true;
> --
> 2.47.1.440.gcaacdb5dfd
>

Reply via email to