This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/56166] std::string::clear() can throw despite being marked noexcept
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 Jan 2013 19:25:27 +0000
- Subject: [Bug libstdc++/56166] std::string::clear() can throw despite being marked noexcept
- Auto-submitted: auto-generated
- References: <bug-56166-4@http.gcc.gnu.org/bugzilla/>
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