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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The ICE could be fixed with

--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -13604,9 +13604,13 @@ set_up_extended_ref_temp (tree decl, tree expr,
vec<tree, va_gc> **cleanups,
       init = NULL_TREE;
     }
   else
-    /* Create the INIT_EXPR that will initialize the temporary
-       variable.  */
-    init = split_nonconstant_init (var, expr);
+    {
+      /* Create the INIT_EXPR that will initialize the temporary
+    variable.  */
+      init = split_nonconstant_init (var, expr);
+      replace_placeholders (init, var);
+    }
+
   if (at_function_scope_p ())
     {
       add_decl_expr (var);


but it'll result in
error: modification of ‘<temporary>’ is not a constant expression
because the INIT_EXPR is
_ZGR1x_.x = (const struct X *) &_ZGR1x_
but _ZGR1x_ isn't in our constexpr context.

Reply via email to