public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/102048] __gnu_cxx::rope.erase(size_t __p) implementation seems to be wrong
Date: Wed, 25 Aug 2021 21:29:02 +0000	[thread overview]
Message-ID: <bug-102048-4-HKCEmw5017@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102048-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102048

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:2cd229dec8d6716938de5052479d059d306969da

commit r12-3146-g2cd229dec8d6716938de5052479d059d306969da
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Aug 25 16:42:49 2021 +0100

    libstdc++: Remove __gnu_cxx::rope::erase(size_type) [PR102048]

    This function claims to remove a single character at index p, but it
    actually removes p+1 characters beginning at p. So r.erase(0) removes
    the first character, but r.erase(1) removes the second and third, and
    r.erase(2) removes the second, third and fourth. This is not a useful
    API.

    The overload is present in the SGI STL <stl_rope.h> header that we
    imported, but it isn't documented in the API reference. The erase
    overloads that are documented are:

    erase(const iterator& p)
    erase(const iterator& f, const iterator& l)
    erase(size_type i, size_type n);

    Having an erase(size_type p) overload that erases a single character (as
    the comment says it does) might be useful, but would be inconsistent
    with std::basic_string::erase(size_type p = 0, size_type n = npos),
    which erases from p to the end of the string when called with a single
    argument.

    Since the function isn't part of the documented API, doesn't do what it
    claims to do (or anything useful) and "fixing" it would leave it
    inconsistent with basic_string, I'm just removing that overload.

    libstdc++-v3/ChangeLog:

            PR libstdc++/102048
            * include/ext/rope (rope::erase(size_type)): Remove broken
            function.

  parent reply	other threads:[~2021-08-25 21:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 18:46 [Bug libstdc++/102048] New: " fstqwq at foxmail dot com
2021-08-24 19:07 ` [Bug libstdc++/102048] " redi at gcc dot gnu.org
2021-08-24 19:12 ` redi at gcc dot gnu.org
2021-08-24 19:34 ` fstqwq at foxmail dot com
2021-08-24 21:11 ` redi at gcc dot gnu.org
2021-08-25 15:20 ` fstqwq at foxmail dot com
2021-08-25 15:50 ` redi at gcc dot gnu.org
2021-08-25 21:29 ` cvs-commit at gcc dot gnu.org [this message]
2021-08-25 22:12 ` redi at gcc dot gnu.org
2021-10-12 19:41 ` cvs-commit at gcc dot gnu.org
2022-04-26 13:13 ` cvs-commit at gcc dot gnu.org
2022-05-06  8:30 ` jakub at gcc dot gnu.org
2022-05-06 12:35 ` redi at gcc dot gnu.org
2022-05-09 16:39 ` cvs-commit at gcc dot gnu.org

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=bug-102048-4-HKCEmw5017@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).