public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-7580] libstdc++: Fix std::__uninitialized_default_n for constant evaluation [PR110542]
Date: Tue, 18 Jul 2023 11:01:05 +0000 (GMT)	[thread overview]
Message-ID: <20230718110105.1754D385AF84@sourceware.org> (raw)

https://gcc.gnu.org/g:a32d4a34da72087c9f9bdfe3f987b808be814cd7

commit r13-7580-ga32d4a34da72087c9f9bdfe3f987b808be814cd7
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jul 4 16:03:45 2023 +0100

    libstdc++: Fix std::__uninitialized_default_n for constant evaluation [PR110542]
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/110542
            * include/bits/stl_uninitialized.h (__uninitialized_default_n):
            Do not use std::fill_n during constant evaluation.
    
    (cherry picked from commit 83cae6c4b788544635a71748e1881c150f42efef)

Diff:
---
 libstdc++-v3/include/bits/stl_uninitialized.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h
index 6752c6b5746..be7b4afdd05 100644
--- a/libstdc++-v3/include/bits/stl_uninitialized.h
+++ b/libstdc++-v3/include/bits/stl_uninitialized.h
@@ -695,6 +695,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     inline _ForwardIterator
     __uninitialized_default_n(_ForwardIterator __first, _Size __n)
     {
+#ifdef __cpp_lib_is_constant_evaluated
+      if (std::is_constant_evaluated())
+	return __uninitialized_default_n_1<false>::
+		 __uninit_default_n(__first, __n);
+#endif
+
       typedef typename iterator_traits<_ForwardIterator>::value_type
 	_ValueType;
       // See uninitialized_fill_n for the conditions for using std::fill_n.

                 reply	other threads:[~2023-07-18 11:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230718110105.1754D385AF84@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).