aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-10-04 13:17:01 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-10-04 13:17:01 +0100
commit44e4da6505935116a2468c56f425c33e70caa10c (patch)
tree2e36b00412d371cc56cb2826c1bbd53d47ceb09c
parent8384956a1b27161775bc0e272614c42e523ee8f6 (diff)
downloadgcc-44e4da6505935116a2468c56f425c33e70caa10c.zip
gcc-44e4da6505935116a2468c56f425c33e70caa10c.tar.gz
gcc-44e4da6505935116a2468c56f425c33e70caa10c.tar.bz2
Adjust tr1::_Hashtable to work with std::allocator in C++20
In C++20 std::allocator will no longer define construct and destroy member functions, so using them needs to go via allocator_traits. * include/tr1/hashtable.h (tr1::_Hashtable::_M_allocate_node): Use __gnu_cxx::__alloc_traits for allocator construct function. (tr1::_Hashtable::_M_deallocate_node): Likewise for destroy function. From-SVN: r276575
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/include/tr1/hashtable.h8
2 files changed, 10 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0076d95..6a3b614 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,9 @@
2019-10-04 Jonathan Wakely <jwakely@redhat.com>
+ * include/tr1/hashtable.h (tr1::_Hashtable::_M_allocate_node): Use
+ __gnu_cxx::__alloc_traits for allocator construct function.
+ (tr1::_Hashtable::_M_deallocate_node): Likewise for destroy function.
+
* include/precompiled/stdc++.h: Include <span> for C++20.
* testsuite/17_intro/names.cc: Do not define 'e' for C++20.
diff --git a/libstdc++-v3/include/tr1/hashtable.h b/libstdc++-v3/include/tr1/hashtable.h
index c1b5c9e..85fec6a 100644
--- a/libstdc++-v3/include/tr1/hashtable.h
+++ b/libstdc++-v3/include/tr1/hashtable.h
@@ -429,7 +429,9 @@ namespace tr1
_Node* __n = _M_node_allocator.allocate(1);
__try
{
- _M_get_Value_allocator().construct(&__n->_M_v, __v);
+ _Value_allocator_type __a = _M_get_Value_allocator();
+ typedef __gnu_cxx::__alloc_traits<_Value_allocator_type> _Traits;
+ _Traits::construct(__a, &__n->_M_v, __v);
__n->_M_next = 0;
return __n;
}
@@ -449,7 +451,9 @@ namespace tr1
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_deallocate_node(_Node* __n)
{
- _M_get_Value_allocator().destroy(&__n->_M_v);
+ _Value_allocator_type __a = _M_get_Value_allocator();
+ typedef __gnu_cxx::__alloc_traits<_Value_allocator_type> _Traits;
+ _Traits::destroy(__a, &__n->_M_v);
_M_node_allocator.deallocate(__n, 1);
}