https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123100
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2025-12-12
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -315,6 +315,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
{
if (char_type* __hi = _M_high_mark())
{
+ if (_M_string.c_str() != this->pbase())
+ return __string_type(this->pbase(), __hi);
+
// Set length to end of character sequence and add null terminator.
_M_string._M_set_length(_M_high_mark() - this->pbase());
}
I think we need to do this, to handle the case where the buffer has been
replaced.
This turns it from a move into a copy, but that's what the program asked for.