public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/101263] non-propagating-cache::emplace-deref missing constexpr
Date: Thu, 14 Oct 2021 15:22:50 +0000	[thread overview]
Message-ID: <bug-101263-4-RPKPFHHdPV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101263-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to Patrick Palka from comment #1)
> > We might first need to implement P2231 (for constexpr optional) before this
> > function can be properly constexpr.
> 
> Implemented in r12-4389

Yay, thanks!  I thought this would be enough to straightforwardly make
emplace-deref constexpr, but I ran into an unrelated wrinkle.  During constexpr
evaluation we can't use placement new to initialize the contained value
directly from *__i and instead have to use the equivalent of
construct_at(&value, *__i), but the latter incurs an extra move due to the
temporary materialization of *__i, which is contrary to the effects of
emplace-deref ([range.nonprop.cache]/1.6):

  Calls reset().  Then initializes the contained value as if
direct-non-list-initializing an object of type T with the argument *i.

Am I missing something or is it not possible to perform this direct-init in the
constexpr case?

  parent reply	other threads:[~2021-10-14 15:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 17:23 [Bug libstdc++/101263] New: " hewillk at gmail dot com
2021-07-13 17:45 ` [Bug libstdc++/101263] " ppalka at gcc dot gnu.org
2021-09-08  7:42 ` rguenth at gcc dot gnu.org
2021-09-08 10:30 ` redi at gcc dot gnu.org
2021-10-14  8:09 ` redi at gcc dot gnu.org
2021-10-14 15:22 ` ppalka at gcc dot gnu.org [this message]
2021-10-14 15:35 ` barry.revzin at gmail dot com
2021-10-14 15:43 ` rs2740 at gmail dot com
2021-10-15 17:27 ` cvs-commit at gcc dot gnu.org
2021-10-15 17:31 ` redi at gcc dot gnu.org
2021-11-24 12:22 ` redi at gcc dot gnu.org
2022-04-21  7:49 ` rguenth at gcc dot gnu.org
2022-04-21  9:18 ` redi 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-101263-4-RPKPFHHdPV@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).