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

            Bug ID: 99942
           Summary: [8/9/10/11 Regression] COW std::string::data() is
                    noexcept but can throw
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

The C++17 non-const data() was fixed for PR 86169 so that it un-shares the
string if needed. However, this means it can reallocate, and so should not be
marked noexcept.

The right fix is probably just to remove 'noexcept', but we might also want to
consider not providing that member function at all for the COW string.

Reply via email to