]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Only define basic_string::contains for C++23
authorJonathan Wakely <jwakely@redhat.com>
Mon, 16 Aug 2021 19:42:54 +0000 (20:42 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 24 Aug 2021 14:16:13 +0000 (15:16 +0100)
The new contains member of the COW string is defined for non-strict
gnu++20 mode as well as for C++23 modes. I think that was left in the
committed patch unintentionally. It is inconsistent with the SSO string,
and doesn't actually compile because it uses the
basic_string_view::contains member which only defined for C++23.

This makes it only defined for C++23.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/basic_string.h (basic_string::contains): Do not
define for -std=gnu++20.

(cherry picked from commit 3b3f2f7c265ef9f176cb811a8049b24538d954d9)

libstdc++-v3/include/bits/basic_string.h

index 037040740ab49afd4d5aa3ed579e1bee65565c38..5d09f774e0345427c3cf0146d5deb19ad1398249 100644 (file)
@@ -6024,8 +6024,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       { return __sv_type(this->data(), this->size()).ends_with(__x); }
 #endif // C++20
 
-#if __cplusplus >= 202011L \
-  || (__cplusplus == 202002L && !defined __STRICT_ANSI__)
+#if __cplusplus > 202011L
       bool
       contains(basic_string_view<_CharT, _Traits> __x) const noexcept
       { return __sv_type(this->data(), this->size()).contains(__x); }