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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This ought to fix it, though it's completely untested:

--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -3661,6 +3661,10 @@ cxx_eval_array_reference (const constexpr_ctx *ctx, tree
t,
     {
       tree empty_ctor = build_constructor (init_list_type_node, NULL);
       val = digest_init (elem_type, empty_ctor, tf_warning_or_error);
+      constexpr_ctx new_ctx = *ctx;
+      new_ctx.ctor = build_constructor (elem_type, NULL);
+      new_ctx.object = NULL_TREE;
+      ctx = &new_ctx;
     }
   else
     val = build_value_init (elem_type, tf_warning_or_error);

Reply via email to