Skip to content

Commit ed55f53

Browse files
committed
Add an exception test to check for memory leak for vector(n, x, a)
1 parent 34b6045 commit ed55f53

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ int main(int, char**) {
139139
check_new_delete_called();
140140
#endif // TEST_STD_VER >= 14
141141

142+
try { // Throw in vector(size_type, value_type, const allocator_type&) from the type
143+
int throw_after = 1;
144+
ThrowingT v(throw_after);
145+
std::vector<ThrowingT> vec(1, v, std::allocator<ThrowingT>());
146+
} catch (int) {
147+
}
148+
check_new_delete_called();
149+
142150
try { // Throw in vector(InputIterator, InputIterator) from input iterator
143151
std::vector<int> vec((Iterator<std::input_iterator_tag>()), Iterator<std::input_iterator_tag>(2));
144152
} catch (int) {

0 commit comments

Comments
 (0)