+2017-01-16 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR libstdc++/78389
+ * include/bits/list.tcc (merge(list&&)): Fix backwards size adjustments.
+ (merge(list&&, _StrictWeakOrdering)): Likewise.
+ * testsuite/23_containers/list/operations/78389.cc: Add
+ better test for the sizes.
+
2017-01-14 Jonathan Wakely <jwakely@redhat.com>
* testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc:
__catch(...)
{
size_t __dist = std::distance(__first2, __last2);
- this->_M_inc_size(__dist);
- __x._M_set_size(__orig_size - __dist);
+ this->_M_inc_size(__orig_size - __dist);
+ __x._M_set_size(__dist);
__throw_exception_again;
}
}
__catch(...)
{
size_t __dist = std::distance(__first2, __last2);
- this->_M_inc_size(__dist);
- __x._M_set_size(__orig_size - __dist);
+ this->_M_inc_size(__orig_size - __dist);
+ __x._M_set_size(__dist);
__throw_exception_again;
}
}
std::list<int> a{1, 2, 3, 4};
std::list<int> b{5, 6, 7, 8, 9, 10, 11, 12};
try {
- a.merge(b, ThrowingComparator{5});
+ a.merge(b, ThrowingComparator{4});
} catch (...) {
}
- VERIFY(a.size() == 8 && b.size() == 4);
+ VERIFY(a.size() == std::distance(a.begin(), a.end()) &&
+ b.size() == std::distance(b.begin(), b.end()));
std::list<X> ax{1, 2, 3, 4};
std::list<X> bx{5, 6, 7, 8, 9, 10, 11, 12};
- throw_after_X = 5;
+ throw_after_X = 4;
try {
ax.merge(bx);
} catch (...) {
}
- VERIFY(ax.size() == 8 && bx.size() == 4);
+ VERIFY(ax.size() == std::distance(ax.begin(), ax.end()) &&
+ bx.size() == std::distance(bx.begin(), bx.end()));
std::list<int> ay{5, 6, 7, 8, 9, 10, 11, 12};
try {
ay.sort(ThrowingComparator{5});