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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<[email protected]>:

https://gcc.gnu.org/g:96dada386d6b3417b5581c07382f54a98c75677f

commit r13-10083-g96dada386d6b3417b5581c07382f54a98c75677f
Author: Jonathan Wakely <[email protected]>
Date:   Mon Feb 9 10:48:44 2026 +0000

    libstdc++: Fix incorrect noexcept on string::compare overloads [PR123991]

    These compare overloads throw when the pos index is out of range, not
    only when the const T& parameter throws on conversion to string_view.

    Remove the incorrect conditional noexcept-specifier from the two
    overloads that can throw.

    libstdc++-v3/ChangeLog:

            PR libstdc++/123991
            * include/bits/basic_string.h (compare(size_type, size_type, T)):
            Remove noexcept-specifier.
            (compare(size_type, size_type, T, size_type, size_type)):
            Likewise.
            * include/bits/cow_string.h (compare(size_type, size_type, T)):
            Remove noexcept-specifier.
            (compare(size_type, size_type, T, size_type, size_type)):
            Likewise.
            *
testsuite/21_strings/basic_string/operations/compare/char/123991.cc:
            New test.
            *
testsuite/21_strings/basic_string/operations/compare/wchar_t/123991.cc:
            New test.

    Reviewed-by: Nathan Myers <[email protected]>
    (cherry picked from commit 0912dfcd1e901d7dc1ff5e10528eefe3f3ff7b22)

Reply via email to