public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Only define basic_string::contains for C++23
Date: Tue, 17 Aug 2021 14:27:21 +0100	[thread overview]
Message-ID: <YRu5Oaes6qwmdnV8@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

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/cow_string.h (basic_string::contains): Do not
	define for -std=gnu++20.

Tested powerpc64le-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1431 bytes --]

commit 3b3f2f7c265ef9f176cb811a8049b24538d954d9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Aug 16 20:42:54 2021

    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 <jwakely@redhat.com>
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/cow_string.h (basic_string::contains): Do not
            define for -std=gnu++20.

diff --git a/libstdc++-v3/include/bits/cow_string.h b/libstdc++-v3/include/bits/cow_string.h
index 5b09cc2a896..61edaa85484 100644
--- a/libstdc++-v3/include/bits/cow_string.h
+++ b/libstdc++-v3/include/bits/cow_string.h
@@ -2963,8 +2963,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       { 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); }

                 reply	other threads:[~2021-08-17 13:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRu5Oaes6qwmdnV8@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).