aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-04-18 00:10:54 +0100
committerJonathan Wakely <jwakely@redhat.com>2020-04-18 00:12:26 +0100
commitc9960294062dbda0847d26a1b5ee37a55210d69c (patch)
tree4cc647117d31c1b45fbf117bb4a26689f2c90acb
parentbd2420f8faaf4bb33310e82f7dd45c5e33476c87 (diff)
downloadgcc-c9960294062dbda0847d26a1b5ee37a55210d69c.zip
gcc-c9960294062dbda0847d26a1b5ee37a55210d69c.tar.gz
gcc-c9960294062dbda0847d26a1b5ee37a55210d69c.tar.bz2
libstdc++: Fix testsuite utility's use of allocators
In C++20 the rebind and const_reference members of std::allocator are gone, so this testsuite utility stopped working, causing ext/pb_ds/regression/priority_queue_rand_debug.cc to FAIL. * testsuite/util/native_type/native_priority_queue.hpp: Use allocator_traits to rebind allocator.
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp27
2 files changed, 26 insertions, 6 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index de9323be..64c862c 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-18 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/util/native_type/native_priority_queue.hpp: Use
+ allocator_traits to rebind allocator.
+
2020-04-17 Jonathan Wakely <jwakely@redhat.com>
* include/bits/forward_list.h (forward_list): Define operator<=> and
diff --git a/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp b/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp
index 1445892..1ceb446 100644
--- a/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp
+++ b/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp
@@ -55,20 +55,30 @@ namespace __gnu_pbds
struct base_seq
{
private:
- typedef typename _Alloc::template rebind<Value_Type> value_rebind;
+#if __cplusplus >= 201103L
+ using value_alloc = typename std::allocator_traits<_Alloc>::template
+ rebind_alloc<Value_Type>;
+#else
+ typedef typename _Alloc::template rebind<Value_Type>::other value_alloc;
+#endif
public:
- typedef std::vector<Value_Type, typename value_rebind::other> type;
+ typedef std::vector<Value_Type, value_alloc> type;
};
template<typename Value_Type, typename _Alloc>
struct base_seq<Value_Type, false, _Alloc>
{
private:
- typedef typename _Alloc::template rebind<Value_Type> value_rebind;
+#if __cplusplus >= 201103L
+ using value_alloc = typename std::allocator_traits<_Alloc>::template
+ rebind_alloc<Value_Type>;
+#else
+ typedef typename _Alloc::template rebind<Value_Type>::other value_alloc;
+#endif
public:
- typedef std::deque<Value_Type, typename value_rebind::other> type;
+ typedef std::deque<Value_Type, value_alloc> type;
};
} // namespace detail
@@ -89,11 +99,16 @@ namespace __gnu_pbds
{
private:
typedef PB_DS_BASE_C_DEC base_type;
- typedef typename _Alloc::template rebind<Value_Type> value_rebind;
+#if __cplusplus >= 201103L
+ using value_ref = const Value_Type&;
+#else
+ typedef typename
+ _Alloc::template rebind<Value_Type>::other::const_reference value_ref;
+#endif
public:
typedef Value_Type value_type;
- typedef typename value_rebind::other::const_reference const_reference;
+ typedef value_ref const_reference;
typedef native_pq_tag container_category;
typedef Cmp_Fn cmp_fn;