summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/debug
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-10-08 14:24:18 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-10-09 00:57:49 +0100
commit0afb9ebaab09b999f1d158ffc3fb906fdab9df67 (patch)
tree4b8a8f44384d99733d8ea59f151f6bb9a44cc618 /libstdc++-v3/include/debug
parentcfeff094e6410844d2324193610cb7a512d67713 (diff)
libstdc++: Always define typedefs and hash functions for wide strings [PR 98725]
The wstring and wstring_view typedefs should be enabled even if <wchar.h> isn't supported, because char_traits<wchar_t> works unconditionally. Similarly, the std::hash specializations for wide strings do not depend on <wchar.h> support. Although the primary template works OK for std::char_traits<wchar_t> in the absence of <wchar.h> support, this patch still defines it as an explicit specialization for compatibility with declarations that expect it to be specialized. The explicit specialization just uses the same __gnu_cxx::char_traits base class as the primary template. libstdc++-v3/ChangeLog: PR libstdc++/98725 * include/bits/char_traits.h (char_traits<wchar_t>): Define explicit specialization unconditionally. * include/bits/basic_string.h (hash<wstring>): Define unconditionally. Do not check _GLIBCXX_USE_WCHAR_T. * include/bits/stringfwd.h (wstring): Likewise. * include/debug/string (wstring): Likewise. * include/experimental/string_view (experimental::wstring_view) (hash<experimental::wstring_view>): Likewise. * include/std/string (pmr::wstring, hash<pmr::wstring>): Likewise. * include/std/string_view (wstring_view, hash<wstring_view>): Likewise.
Diffstat (limited to 'libstdc++-v3/include/debug')
-rw-r--r--libstdc++-v3/include/debug/string2
1 files changed, 0 insertions, 2 deletions
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 8744a55be64..a8389528001 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -1298,9 +1298,7 @@ namespace __gnu_debug
typedef basic_string<char> string;
-#ifdef _GLIBCXX_USE_WCHAR_T
typedef basic_string<wchar_t> wstring;
-#endif
#ifdef _GLIBCXX_USE_CHAR8_T
/// A string of @c char8_t