[Bug libstdc++/86295] Missing exception safety when inserting range into vector
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jun 25 13:35:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86295
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Kristian Spangsege from comment #0)
> The problem occurs when either `std::__uninitialized_copy_a()` or
> `std::__uninitialized_move_a()` throws due to throwing from the copy or move
> constructor of the value type. In this case, the logical size of the vector
> remains at its prior value, which means that if any objects were created,
> they will be forgotten about (leaked).
Do you have a testcase?
If an exception occurs in __uninitialized_copy_a and __uninitialized_move_a
they will destroy any objects they created, so I don't see how they can leak.
More information about the Gcc-bugs
mailing list