1717#include < vector>
1818
1919#include " count_new.h"
20+ #include " test_allocator.h"
2021#include " test_iterators.h"
2122
2223template <class T >
@@ -36,7 +37,9 @@ struct Allocator {
3637 void deallocate (T* ptr, std::size_t n) { std::allocator<T>().deallocate (ptr, n); }
3738
3839 template <class U >
39- friend bool operator ==(const Allocator&, const Allocator<U>&) { return true ; }
40+ friend bool operator ==(const Allocator&, const Allocator<U>&) {
41+ return true ;
42+ }
4043};
4144
4245struct ThrowingT {
@@ -138,7 +141,7 @@ int main(int, char**) {
138141 } catch (int ) {
139142 }
140143 check_new_delete_called ();
141- #endif // TEST_STD_VER >= 14
144+ #endif // TEST_STD_VER >= 14
142145
143146 try { // Throw in vector(size_type, value_type, const allocator_type&) from the type
144147 int throw_after = 1 ;
@@ -217,11 +220,12 @@ int main(int, char**) {
217220 }
218221 check_new_delete_called ();
219222
220- try { // Throw in vector(vector&&, const allocator_type&) from type
221- std::vector<ThrowingT, Allocator<ThrowingT> > vec (Allocator<ThrowingT>(false ));
222- int throw_after = 1 ;
223- vec.emplace_back (throw_after);
224- std::vector<ThrowingT, Allocator<ThrowingT> > vec2 (std::move (vec), Allocator<ThrowingT>(false ));
223+ try { // Throw in vector(vector&&, const allocator_type&) from type during element-wise move
224+ std::vector<ThrowingT, test_allocator<ThrowingT> > vec (test_allocator<ThrowingT>(1 ));
225+ int throw_after = 10 ;
226+ ThrowingT v (throw_after);
227+ vec.insert (vec.end (), 6 , v);
228+ std::vector<ThrowingT, test_allocator<ThrowingT> > vec2 (std::move (vec), test_allocator<ThrowingT>(2 ));
225229 } catch (int ) {
226230 }
227231 check_new_delete_called ();
0 commit comments