https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99942
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:6586b015f1211ccd6e3e89b44dcb2116347edf89 commit r15-2650-g6586b015f1211ccd6e3e89b44dcb2116347edf89 Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Mar 27 11:07:17 2024 +0000 libstdc++: Remove noexcept from non-const std::basic_string::data() [PR99942] The C++17 non-const overload of data() allows modifying the string contents directly, so for the COW string we must do a copy-on-write to unshare it. That means allocating, which can throw, so it shouldn't be noexcept. libstdc++-v3/ChangeLog: PR libstdc++/99942 * include/bits/cow_string.h (data()): Change to noexcept(false).