diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 8b3b7a5a..0bd7a20e 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -3595,8 +3595,7 @@ struct table : boost::unordered::detail::functionsset_first_in_group(); } --other.size_; - other.fix_bucket( - other.node_bucket(n), prev, n2); + other.fix_bucket(other.node_bucket(n), prev, n2); this->add_node_unique(n, key_hash); } } @@ -4274,7 +4273,8 @@ inline void table::rehash_impl(std::size_t num_buckets) } } } - BOOST_CATCH(...) { + BOOST_CATCH(...) + { delete_nodes(prev, node_pointer()); BOOST_RETHROW } diff --git a/test/exception/assign_exception_tests.cpp b/test/exception/assign_exception_tests.cpp index 2b39bf74..49019fdd 100644 --- a/test/exception/assign_exception_tests.cpp +++ b/test/exception/assign_exception_tests.cpp @@ -23,8 +23,11 @@ template struct self_assign_base : public test::exception_base typedef T data_type; T init() const { return T(values.begin(), values.end()); } - void run(T& x) const { + void run(T& x) const + { x = x; + + DISABLE_EXCEPTIONS; test::check_container(x, values); test::check_equivalent_keys(x); } @@ -65,8 +68,11 @@ template struct assign_base : public test::exception_base typedef T data_type; T init() const { return T(x); } - void run(T& x1) const { + void run(T& x1) const + { x1 = y; + + DISABLE_EXCEPTIONS; test::check_container(x1, y_values); test::check_equivalent_keys(x1); } diff --git a/test/exception/constructor_exception_tests.cpp b/test/exception/constructor_exception_tests.cpp index e4a12420..503cce0e 100644 --- a/test/exception/constructor_exception_tests.cpp +++ b/test/exception/constructor_exception_tests.cpp @@ -6,8 +6,8 @@ #include "./containers.hpp" #include "../helpers/input_iterator.hpp" -#include "../helpers/random_values.hpp" #include "../helpers/invariants.hpp" +#include "../helpers/random_values.hpp" #include "../helpers/tracker.hpp" template inline void avoid_unused_warning(T const&) {} @@ -27,6 +27,8 @@ template struct construct_test1 : public objects, test::exception_base void run() const { T x; + + DISABLE_EXCEPTIONS; BOOST_TEST(x.empty()); test::check_equivalent_keys(x); } @@ -37,6 +39,8 @@ template struct construct_test2 : public objects, test::exception_base void run() const { T x(300); + + DISABLE_EXCEPTIONS; BOOST_TEST(x.empty()); test::check_equivalent_keys(x); } @@ -47,6 +51,8 @@ template struct construct_test3 : public objects, test::exception_base void run() const { T x(0, hash); + + DISABLE_EXCEPTIONS; BOOST_TEST(x.empty()); test::check_equivalent_keys(x); } @@ -57,6 +63,8 @@ template struct construct_test4 : public objects, test::exception_base void run() const { T x(0, hash, equal_to); + + DISABLE_EXCEPTIONS; BOOST_TEST(x.empty()); test::check_equivalent_keys(x); } @@ -67,6 +75,8 @@ template struct construct_test5 : public objects, test::exception_base void run() const { T x(50, hash, equal_to, allocator); + + DISABLE_EXCEPTIONS; BOOST_TEST(x.empty()); test::check_equivalent_keys(x); } @@ -77,6 +87,8 @@ template struct construct_test6 : public objects, test::exception_base void run() const { T x(allocator); + + DISABLE_EXCEPTIONS; BOOST_TEST(x.empty()); test::check_equivalent_keys(x); } @@ -95,6 +107,8 @@ template struct range_construct_test1 : public range, objects void run() const { T x(this->values.begin(), this->values.end()); + + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); } @@ -105,6 +119,8 @@ template struct range_construct_test2 : public range, objects void run() const { T x(this->values.begin(), this->values.end(), 0); + + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); } @@ -115,6 +131,8 @@ template struct range_construct_test3 : public range, objects void run() const { T x(this->values.begin(), this->values.end(), 0, hash); + + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); } @@ -125,6 +143,8 @@ template struct range_construct_test4 : public range, objects void run() const { T x(this->values.begin(), this->values.end(), 100, hash, equal_to); + + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); } @@ -140,6 +160,8 @@ template struct range_construct_test5 : public range, objects { T x(this->values.begin(), this->values.end(), 0, hash, equal_to, allocator); + + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); } @@ -156,6 +178,8 @@ template struct input_range_construct_test : public range, objects end = this->values.end(); T x(test::input_iterator(begin), test::input_iterator(end), 0, hash, equal_to, allocator); + + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); } @@ -170,6 +194,8 @@ template struct copy_range_construct_test : public range, objects T x(test::copy_iterator(this->values.begin()), test::copy_iterator(this->values.end()), 0, hash, equal_to, allocator); + + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); } diff --git a/test/exception/copy_exception_tests.cpp b/test/exception/copy_exception_tests.cpp index 2faa7e84..1e57872c 100644 --- a/test/exception/copy_exception_tests.cpp +++ b/test/exception/copy_exception_tests.cpp @@ -5,8 +5,8 @@ #include "./containers.hpp" -#include "../helpers/random_values.hpp" #include "../helpers/invariants.hpp" +#include "../helpers/random_values.hpp" #include "../helpers/tracker.hpp" template inline void avoid_unused_warning(T const&) {} @@ -20,6 +20,8 @@ template struct copy_test1 : public test::exception_base void run() const { T y(x); + + DISABLE_EXCEPTIONS; BOOST_TEST(y.empty()); test::check_equivalent_keys(y); } @@ -35,6 +37,8 @@ template struct copy_test2 : public test::exception_base void run() const { T y(x); + + DISABLE_EXCEPTIONS; test::check_container(y, this->values); test::check_equivalent_keys(y); } @@ -50,6 +54,8 @@ template struct copy_test3 : public test::exception_base void run() const { T y(x); + + DISABLE_EXCEPTIONS; test::check_container(y, this->values); test::check_equivalent_keys(y); } @@ -66,6 +72,8 @@ template struct copy_with_allocator_test : public test::exception_base void run() const { T y(x, allocator); + + DISABLE_EXCEPTIONS; test::check_container(y, this->values); test::check_equivalent_keys(y); } diff --git a/test/exception/erase_exception_tests.cpp b/test/exception/erase_exception_tests.cpp index 719ceb87..f400bdd9 100644 --- a/test/exception/erase_exception_tests.cpp +++ b/test/exception/erase_exception_tests.cpp @@ -44,8 +44,9 @@ template struct erase_by_key_test1 : public erase_test_base x.erase(test::get_key(*it)); } + DISABLE_EXCEPTIONS; BOOST_TEST(x.empty()); - test::check_equivalent_keys(x); + test::check_equivalent_keys(x); } }; diff --git a/test/exception/move_assign_exception_tests.cpp b/test/exception/move_assign_exception_tests.cpp index 048ab102..ac0eaf1c 100644 --- a/test/exception/move_assign_exception_tests.cpp +++ b/test/exception/move_assign_exception_tests.cpp @@ -44,6 +44,7 @@ template struct move_assign_base : public test::exception_base disable_exceptions.release(); x1 = boost::move(y1); + DISABLE_EXCEPTIONS; test::check_container(x1, y_values); test::check_equivalent_keys(x1); } diff --git a/test/exception/rehash_exception_tests.cpp b/test/exception/rehash_exception_tests.cpp index ae31f397..6781508b 100644 --- a/test/exception/rehash_exception_tests.cpp +++ b/test/exception/rehash_exception_tests.cpp @@ -53,6 +53,7 @@ template struct rehash_test0 : rehash_test_base void run(T& x) const { x.rehash(0); + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); @@ -65,6 +66,7 @@ template struct rehash_test1 : rehash_test_base void run(T& x) const { x.rehash(200); + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); @@ -77,6 +79,7 @@ template struct rehash_test2 : rehash_test_base void run(T& x) const { x.rehash(0); + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); @@ -89,6 +92,7 @@ template struct rehash_test3 : rehash_test_base void run(T& x) const { x.rehash(200); + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); @@ -101,6 +105,7 @@ template struct rehash_test4 : rehash_test_base void run(T& x) const { x.rehash(0); + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); @@ -113,6 +118,7 @@ template struct rehash_test5 : rehash_test_base void run(T& x) const { x.rehash(0); + DISABLE_EXCEPTIONS; test::check_container(x, this->values); test::check_equivalent_keys(x); diff --git a/test/exception/swap_exception_tests.cpp b/test/exception/swap_exception_tests.cpp index 13ee18b3..341e67d5 100644 --- a/test/exception/swap_exception_tests.cpp +++ b/test/exception/swap_exception_tests.cpp @@ -23,7 +23,8 @@ template struct self_swap_base : public test::exception_base typedef T data_type; T init() const { return T(values.begin(), values.end()); } - void run(T& x) const { + void run(T& x) const + { x.swap(x); DISABLE_EXCEPTIONS;