This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/86295] Missing exception safety when inserting range into vector
- 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: Mon, 25 Jun 2018 13:35:53 +0000
- Subject: [Bug libstdc++/86295] Missing exception safety when inserting range into vector
- Auto-submitted: auto-generated
- References: <bug-86295-4@http.gcc.gnu.org/bugzilla/>
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.