You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deque<T>(size_t,const Allocator&) lacks a tidy guard now. When the default constructor of a T throws, no destructor of constructed Ts will be called.
For example, in the code below, test([] {std::deque<resource>f(10); }); will print "created:5 destroyed:0". The expected behavior should be "created:5 destroyed:5" as the other code do.
Causes: In the implementation, the use of resize is wrong as it doesn't do cleanup on exception, and the construction is not completed so ~deque() won't be called either.
The text was updated successfully, but these errors were encountered:
achabense
changed the title
<deque>(size_t,const Allocator&) doesn't handle exceptions properly<deque>(size_t,const Allocator&) doesn't clear up constructed elements on exception
May 19, 2023
achabense
changed the title
<deque>(size_t,const Allocator&) doesn't clear up constructed elements on exceptiondeque(size_t,const Allocator&) doesn't clear up constructed elements on exception
May 19, 2023
deque<T>(size_t,const Allocator&)
lacks a tidy guard now. When the default constructor of aT
throws, no destructor of constructedT
s will be called.For example, in the code below,
test([] {std::deque<resource>f(10); });
will print"created:5 destroyed:0"
. The expected behavior should be"created:5 destroyed:5"
as the other code do.Causes: In the implementation, the use of
resize
is wrong as it doesn't do cleanup on exception, and the construction is not completed so~deque()
won't be called either.STL/stl/inc/deque
Lines 622 to 628 in a621095
The text was updated successfully, but these errors were encountered: