[Bug libstdc++/56166] std::string::clear() can throw despite being marked noexcept
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 31 19:25:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56166
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-01-31
Ever Confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-31 19:25:27 UTC ---
(In reply to comment #0)
> _M_mutate can allocate memory even when it's being asked to erase the string
> (presumably due to internal reference-counting
If another string shares the same representation then you can't just modify the
representation, you need to create your own clone first, *then* clear it.
For the default configuration we could just point to the shared empty rep, I
wonder why we don't do that. For the _GLIBCXX_FULLY_DYNAMIC_STRING case we
should probably remove noexcept
More information about the Gcc-bugs
mailing list