public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/107079] [10/11/12/13 Regression] ICE initializing lifetime-extended constexpr variable that stores its this pointer
Date: Tue, 07 Feb 2023 21:01:28 +0000	[thread overview]
Message-ID: <bug-107079-4-GcnhEvVf6T@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107079-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2023-02-07 21:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 21:58 [Bug c++/107079] New: " johelegp at gmail dot com
2022-09-29 14:26 ` [Bug c++/107079] [10/11/12/13 Regression] " mpolacek at gcc dot gnu.org
2023-02-03 20:59 ` mpolacek at gcc dot gnu.org
2023-02-03 23:32 ` mpolacek at gcc dot gnu.org
2023-02-07 21:01 ` mpolacek at gcc dot gnu.org [this message]
2023-02-08 19:01 ` mpolacek at gcc dot gnu.org
2023-02-10  0:06 ` cvs-commit at gcc dot gnu.org
2023-02-10  0:07 ` [Bug c++/107079] [10/11/12 " mpolacek at gcc dot gnu.org
2023-03-07 16:24 ` cvs-commit at gcc dot gnu.org
2023-03-07 16:25 ` [Bug c++/107079] [10/11 " mpolacek at gcc dot gnu.org
2023-06-30 13:58 ` ppalka at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107079-4-GcnhEvVf6T@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).