From: Jonathan Wakely Date: Thu, 30 Jul 2020 19:58:09 +0000 (+0100) Subject: libstdc++: Make COW string use allocator_traits for nested types X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=505297f57e1919a2a328a136f20181cc5b81a807;p=thirdparty%2Fgcc.git libstdc++: Make COW string use allocator_traits for nested types When compiled as C++20 the COW std::string fails due to assuming that the allocator always defines size_type and difference_type. That has been incorrect since C++11, but we got away with it for specializations using std::allocator until those members were removed in C++20. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (size_type, difference_type): Use allocator_traits to obtain the allocator's size_type and difference_type. --- diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index bc0c256b65e4..52cecdd7ca1e 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -3147,8 +3147,8 @@ _GLIBCXX_END_NAMESPACE_CXX11 typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef _Alloc allocator_type; - typedef typename _CharT_alloc_type::size_type size_type; - typedef typename _CharT_alloc_type::difference_type difference_type; + typedef typename _CharT_alloc_traits::size_type size_type; + typedef typename _CharT_alloc_traits::difference_type difference_type; #if __cplusplus < 201103L typedef typename _CharT_alloc_type::reference reference; typedef typename _CharT_alloc_type::const_reference const_reference;