From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8361B3858435; Tue, 12 Oct 2021 19:41:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8361B3858435 From: "cvs-commit at gcc dot 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: Tue, 12 Oct 2021 19:41:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2021 19:41:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102048 --- Comment #9 from CVS Commits --- The releases/gcc-11 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:a1dc688940ffade63452c8f9d80fd4b3204e5f40 commit r11-9134-ga1dc688940ffade63452c8f9d80fd4b3204e5f40 Author: Jonathan Wakely 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 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 =3D 0, size_type n =3D 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. (cherry picked from commit 2cd229dec8d6716938de5052479d059d306969da)=