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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I suppose we need something like

--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -2909,6 +2909,11 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree
t,
      gcc_assert (arg0);
      if (new_op_p)
        {
+         if (!tree_fits_uhwi_p (arg0))
+       {
+         *non_constant_p = true;
+         return t;
+       }
          tree type = build_array_type_nelts (char_type_node,
                          tree_to_uhwi (arg0));
          tree var = build_decl (loc, VAR_DECL,


except perhaps with an error message.

Reply via email to