]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix last std::tuple constructor missing 'constexpr' [PR102270]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 17 Sep 2021 11:27:02 +0000 (12:27 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 17 Sep 2021 19:43:34 +0000 (20:43 +0100)
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.

libstdc++-v3/include/std/tuple
libstdc++-v3/testsuite/20_util/tuple/cons/102270.cc [moved from libstdc++-v3/testsuite/20_util/tuple/cons/102270.C with 95% similarity]
libstdc++-v3/testsuite/util/testsuite_allocator.h

index 6f0dc6346e1f32501a50f1e3d68b0562316b2938..120c80a2b785232342b9f55c399fdfea25a6ddde 100644 (file)
@@ -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...),
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 998329817c747ffab2c24dbf228670f1a23c6ef7..5500cacab6d6e331bf3c8bad1680bdabea5437e5 100644 (file)
@@ -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() );
index 1f7912ea6eb3afcd42e80445deecb7bdcd985ab0..b5b402858a6778772495c6da9c37867a97d1b81e 100644 (file)
@@ -514,7 +514,7 @@ namespace __gnu_test
     {
       typedef Tp value_type;
 
-      SimpleAllocator() noexcept { }
+      constexpr SimpleAllocator() noexcept { }
 
       template <class T>
         SimpleAllocator(const SimpleAllocator<T>&) { }