public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/102921] error: modification of '<temporary>' is not a constant expression
Date: Mon, 25 Oct 2021 08:27:51 +0000	[thread overview]
Message-ID: <bug-102921-4-1yHDmIK12G@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102921-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/cp/call.c.jj    2021-10-21 16:06:42.231940456 +0200
+++ gcc/cp/call.c       2021-10-25 10:20:00.970635564 +0200
@@ -12735,7 +12735,9 @@ set_up_extended_ref_temp (tree decl, tre

   /* If the initializer is constant, put it in DECL_INITIAL so we get
      static initialization and use in constant expressions.  */
-  init = maybe_constant_init (expr);
+  init = maybe_constant_init (expr, NULL_TREE,
+                             VAR_P (decl)
+                             && DECL_DECLARED_CONSTEXPR_P (decl));
   /* As in store_init_value.  */
   init = cp_fully_fold (init);
   if (TREE_CONSTANT (init))
makes this accepted, but not the PR101588 testcase.

  parent reply	other threads:[~2021-10-25  8:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-24 23:39 [Bug c++/102921] New: " f.heckenbach@fh-soft.de
2021-10-24 23:43 ` [Bug c++/102921] " f.heckenbach@fh-soft.de
2021-10-25  8:03 ` jakub at gcc dot gnu.org
2021-10-25  8:27 ` jakub at gcc dot gnu.org [this message]
2023-06-30 14:01 ` 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-102921-4-1yHDmIK12G@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).