From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 73B96385842E; Tue, 24 Aug 2021 16:01:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73B96385842E MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-8919] libstdc++: Only define basic_string::contains for C++23 X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 60de2b5874021dc3d6bf66b607aac69319f69499 X-Git-Newrev: 0e19dc858234a872e1e719fa05d4c7ccf6a2c483 Message-Id: <20210824160118.73B96385842E@sourceware.org> Date: Tue, 24 Aug 2021 16:01:18 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2021 16:01:18 -0000 https://gcc.gnu.org/g:0e19dc858234a872e1e719fa05d4c7ccf6a2c483 commit r11-8919-g0e19dc858234a872e1e719fa05d4c7ccf6a2c483 Author: Jonathan Wakely Date: Mon Aug 16 20:42:54 2021 +0100 libstdc++: Only define basic_string::contains for C++23 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 libstdc++-v3/ChangeLog: * include/bits/basic_string.h (basic_string::contains): Do not define for -std=gnu++20. (cherry picked from commit 3b3f2f7c265ef9f176cb811a8049b24538d954d9) Diff: --- libstdc++-v3/include/bits/basic_string.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 037040740ab..5d09f774e03 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -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); }