public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Fix last std::tuple constructor missing 'constexpr' [PR102270]
Date: Fri, 17 Sep 2021 20:45:47 +0100	[thread overview]
Message-ID: <YUTwa30IC4S3Chxm@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

Also rename the test so it actually runs.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/102270
	* include/std/tuple (_Tuple_impl): Add constexpr to constructor
	missed in previous patch.
	* testsuite/20_util/tuple/cons/102270.C: Moved to...
	* testsuite/20_util/tuple/cons/102270.cc: ...here.
	* testsuite/util/testsuite_allocator.h (SimpleAllocator): Add
	constexpr to constructor so it can be used for C++20 tests.

Tested powerpc64le-linux. Committed to trunk.

git mailpatch 42eff613d0c10f88dc7a44b14981876401a09981

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2448 bytes --]

commit 1fa2c5a695bb962ffcf8abed49f69cdcc59d0e61
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Sep 17 12:27:02 2021

    libstdc++: Fix last std::tuple constructor missing 'constexpr' [PR102270]
    
    Also rename the test so it actually runs.
    
    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/102270
            * include/std/tuple (_Tuple_impl): Add constexpr to constructor
            missed in previous patch.
            * testsuite/20_util/tuple/cons/102270.C: Moved to...
            * testsuite/20_util/tuple/cons/102270.cc: ...here.
            * testsuite/util/testsuite_allocator.h (SimpleAllocator): Add
            constexpr to constructor so it can be used for C++20 tests.

diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 6f0dc6346e1..120c80a2b78 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -330,6 +330,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	{ }
 
       template<typename _Alloc>
+	_GLIBCXX20_CONSTEXPR
 	_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
 		    const _Head& __head, const _Tail&... __tail)
 	: _Inherited(__tag, __a, __tail...),
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/102270.C b/libstdc++-v3/testsuite/20_util/tuple/cons/102270.cc
similarity index 95%
rename from libstdc++-v3/testsuite/20_util/tuple/cons/102270.C
rename to libstdc++-v3/testsuite/20_util/tuple/cons/102270.cc
index 998329817c7..5500cacab6d 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/cons/102270.C
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/102270.cc
@@ -56,6 +56,9 @@ constexpr bool construct_using_allocator()
 
   std::tuple<X1a, X1a, X1b, X1b> t1a1b(std::allocator_arg, a, 1, i, 1, i);
 
+  const int c = 0;
+  std::tuple<int, int> tii(std::allocator_arg, a, c, c);
+
   return true;
 }
 static_assert( construct_using_allocator() );
diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index 1f7912ea6eb..b5b402858a6 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -514,7 +514,7 @@ namespace __gnu_test
     {
       typedef Tp value_type;
 
-      SimpleAllocator() noexcept { }
+      constexpr SimpleAllocator() noexcept { }
 
       template <class T>
         SimpleAllocator(const SimpleAllocator<T>&) { }

             reply	other threads:[~2021-09-17 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 19:45 Jonathan Wakely [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-16 22:07 [committed] libstdc++: Add missing 'constexpr' to std::tuple [PR102270] Jonathan Wakely
2021-09-17 11:25 ` Jonathan Wakely
2021-09-17 19:47   ` [committed] libstdc++: Fix last std::tuple constructor missing 'constexpr' [PR102270] Jonathan Wakely
2021-09-17 19:48     ` Jonathan Wakely

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=YUTwa30IC4S3Chxm@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@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).