Fix exception bug in asssignment.

The hash and key equality functions were assigned before allocating new
buckets. If that allocation failed, then the existing elements would be
left in place - so if accessed after the exception they could be in the
wrong buckets or equivalent elements could be incorrectly grouped
together.
This commit is contained in:
Daniel James
2016-10-02 13:04:25 +01:00
parent 588ad6e69f
commit e7b20d2877
5 changed files with 159 additions and 6 deletions

View File

@@ -111,6 +111,12 @@ struct assign_test4 : assign_values<T>
assign_test4() : assign_values<T>(10, 10, 1, 2) {}
};
template <class T>
struct assign_test4a : assign_values<T>
{
assign_test4a() : assign_values<T>(10, 100, 1, 2) {}
};
template <class T>
struct assign_test5 : assign_values<T>
{
@@ -136,7 +142,7 @@ struct equivalent_test1 : assign_base<T>
EXCEPTION_TESTS(
(self_assign_test1)(self_assign_test2)
(assign_test1)(assign_test2)(assign_test3)(assign_test4)(assign_test5)
(assign_test1)(assign_test2)(assign_test3)(assign_test4)(assign_test4a)(assign_test5)
(equivalent_test1),
CONTAINER_SEQ)
RUN_TESTS()