Skip to content

Commit b579778

Browse files
multimap.cons excep move_alloc and move_assign
1 parent 10dad7c commit b579778

19 files changed

+25
-44
lines changed

libcxx/include/__tree

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,20 +1121,22 @@ public:
11211121
return;
11221122

11231123
if (__root() == nullptr) { // Make sure we always have a root node
1124-
__insert_node_at(
1125-
__end_node(), __end_node()->__left_, static_cast<__node_base_pointer>(__construct_node(*__first).release()));
1124+
__insert_node_at(__end_node(),
1125+
__end_node()->__left_,
1126+
std::__static_fancy_pointer_cast<__node_base_pointer>(__construct_node(*__first).release()));
11261127
++__first;
11271128
}
11281129

1129-
auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root())));
1130+
auto __max_node = std::__static_fancy_pointer_cast<__node_pointer>(
1131+
std::__tree_max(std::__static_fancy_pointer_cast<__node_base_pointer>(__root())));
11301132

11311133
for (; __first != __last; ++__first) {
11321134
__node_holder __nd = __construct_node(*__first);
11331135
// Always check the max node first. This optimizes for sorted ranges inserted at the end.
11341136
if (!value_comp()(__nd->__get_value(), __max_node->__get_value())) { // __node >= __max_val
1135-
__insert_node_at(static_cast<__end_node_pointer>(__max_node),
1137+
__insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node),
11361138
__max_node->__right_,
1137-
static_cast<__node_base_pointer>(__nd.get()));
1139+
std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get()));
11381140
__max_node = __nd.release();
11391141
} else {
11401142
__end_node_pointer __parent;
@@ -1899,7 +1901,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent
18991901
}
19001902
} else {
19011903
if (__nd->__right_ != nullptr)
1902-
__nd = static_cast<__node_pointer>(__nd->__right_);
1904+
__nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_);
19031905
else {
19041906
__parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd);
19051907
return __nd->__right_;
@@ -2062,8 +2064,8 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) {
20622064
__node_holder __h = __construct_node(std::forward<_Args>(__args)...);
20632065
__end_node_pointer __parent;
20642066
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__get_value());
2065-
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
2066-
return iterator(static_cast<__node_pointer>(__h.release()));
2067+
__insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
2068+
return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__h.release()));
20672069
}
20682070

20692071
template <class _Tp, class _Compare, class _Allocator>

libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "min_allocator.h"
2222

2323
template <template <class> class Alloc>
24-
void test_alloc() {
24+
TEST_CONSTEXPR_CXX26 void test_alloc() {
2525
{ // Simple check
2626
using V = std::pair<const int, int>;
2727
using Map = std::multimap<int, int, std::less<int>, Alloc<V> >;

libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "min_allocator.h"
2222

2323
template <class Alloc>
24-
void test_alloc(const Alloc& new_alloc) {
24+
TEST_CONSTEXPR_CXX26 void test_alloc(const Alloc& new_alloc) {
2525
{ // Simple check
2626
using V = std::pair<const int, int>;
2727
using Map = std::multimap<int, int, std::less<int>, Alloc>;

libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,48 @@ class tracking_allocator {
3333
using value_type = T;
3434
using propagate_on_container_copy_assignment = std::true_type;
3535

36+
TEST_CONSTEXPR_CXX26
3637
tracking_allocator(std::vector<void*>& allocs) : allocs_(&allocs) {}
3738

3839
template <class U>
39-
tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
40+
TEST_CONSTEXPR_CXX26 tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
4041

42+
TEST_CONSTEXPR_CXX26
4143
T* allocate(std::size_t n) {
4244
T* allocation = std::allocator<T>().allocate(n);
4345
allocs_->push_back(allocation);
4446
return allocation;
4547
}
4648

49+
TEST_CONSTEXPR_CXX26
4750
void deallocate(T* ptr, std::size_t n) TEST_NOEXCEPT {
4851
auto res = std::remove(allocs_->begin(), allocs_->end(), ptr);
4952
assert(res != allocs_->end() && "Trying to deallocate memory from different allocator?");
5053
allocs_->erase(res);
5154
std::allocator<T>().deallocate(ptr, n);
5255
}
5356

57+
TEST_CONSTEXPR_CXX26
5458
friend bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
5559
return lhs.allocs_ == rhs.allocs_;
5660
}
5761

62+
TEST_CONSTEXPR_CXX26
5863
friend bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
5964
return lhs.allocs_ != rhs.allocs_;
6065
}
6166
};
6267

6368
struct NoOp {
69+
TEST_CONSTEXPR_CXX26
6470
void operator()() {}
6571
};
6672

6773
template <class Alloc, class AllocatorInvariant = NoOp>
68-
void test_alloc(const Alloc& lhs_alloc = Alloc(),
69-
const Alloc& rhs_alloc = Alloc(),
70-
AllocatorInvariant check_alloc_invariant = NoOp()) {
74+
TEST_CONSTEXPR_CXX26 void
75+
test_alloc(const Alloc& lhs_alloc = Alloc(),
76+
const Alloc& rhs_alloc = Alloc(),
77+
AllocatorInvariant check_alloc_invariant = NoOp()) {
7178
{ // Test empty/non-empty multimap combinations
7279
{ // assign from a non-empty container into an empty one
7380
using V = std::pair<const int, int>;
@@ -258,9 +265,11 @@ bool test() {
258265
std::vector<void*>* rhs_allocs_;
259266

260267
public:
268+
TEST_CONSTEXPR_CXX26
261269
AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
262270
: lhs_allocs_(&lhs_allocs), rhs_allocs_(&rhs_allocs) {}
263271

272+
TEST_CONSTEXPR_CXX26
264273
void operator()() {
265274
assert(lhs_allocs_->empty());
266275
assert(rhs_allocs_->empty());

libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ bool test() {
215215

216216
AssociativeContainerDeductionGuidesSfinaeAway<std::multimap, std::multimap<int, long>>();
217217

218-
return 0;
219-
220218
return true;
221219
}
222220
int main(int, char**) {

libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ bool test() {
104104
assert(m.get_allocator().get_id() == 45);
105105
}
106106

107-
return 0;
108-
109107
return true;
110108
}
111109
int main(int, char**) {

libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ bool test() {
5252
}
5353
#endif
5454

55-
return 0;
56-
5755
return true;
5856
}
5957
int main(int, char**) {

libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ bool test() {
5454
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
5555
}
5656

57-
return 0;
58-
5957
return true;
6058
}
6159
int main(int, char**) {

libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ bool test() {
4444
test_map_exception_safety_throwing_copy<std::multimap>();
4545
test_map_exception_safety_throwing_allocator<std::multimap, int, int>();
4646

47-
return 0;
48-
4947
return true;
5048
}
5149
int main(int, char**) {

libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ bool test() {
5757
assert(*++i == V(3, 2));
5858
}
5959

60-
return 0;
61-
6260
return true;
6361
}
6462
int main(int, char**) {

0 commit comments

Comments
 (0)