summaryrefslogtreecommitdiff
path: root/test/std/containers/associative
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/associative')
-rw-r--r--test/std/containers/associative/iterator_types.pass.cpp131
-rw-r--r--test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp31
-rw-r--r--test/std/containers/associative/map/compare.pass.cpp2
-rw-r--r--test/std/containers/associative/map/incomplete_type.pass.cpp29
-rw-r--r--test/std/containers/associative/map/map.access/at.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.access/empty.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.access/index_key.pass.cpp43
-rw-r--r--test/std/containers/associative/map/map.access/index_rv_key.pass.cpp29
-rw-r--r--test/std/containers/associative/map/map.access/iterator.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.access/max_size.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.access/size.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/compare.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/associative/map/map.cons/copy.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/copy_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/default.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/associative/map/map.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/move.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/move_alloc.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.modifiers/clear.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/emplace.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp31
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp103
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp91
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp96
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp11
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp108
-rw-r--r--test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp13
-rw-r--r--test/std/containers/associative/map/map.ops/count.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/count0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/count1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/count2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/count3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/find.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/find0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/find1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/find2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/find3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound.pass.cpp4
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound.pass.cpp4
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.special/member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.special/non_member_swap.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp24
-rw-r--r--test/std/containers/associative/map/types.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/empty.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/incomplete_type.pass.cpp29
-rw-r--r--test/std/containers/associative/multimap/iterator.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/max_size.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/default.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp (renamed from test/std/containers/associative/map/version.pass.cpp)14
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp94
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp90
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp96
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp91
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp25
-rw-r--r--test/std/containers/associative/multimap/size.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/types.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/clear.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/count.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/emplace.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/empty.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/equal_range.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/associative/multiset/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/erase_key.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/find.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/incomplete_type.pass.cpp29
-rw-r--r--test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp (renamed from test/std/containers/associative/set/version.pass.cpp)12
-rw-r--r--test/std/containers/associative/multiset/insert_cv.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_iter_cv.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_iter_rv.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_rv.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/iterator.pass.cpp6
-rw-r--r--test/std/containers/associative/multiset/lower_bound.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/max_size.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/default.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp4
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp25
-rw-r--r--test/std/containers/associative/multiset/size.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/types.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/upper_bound.pass.cpp2
-rw-r--r--test/std/containers/associative/set/clear.pass.cpp2
-rw-r--r--test/std/containers/associative/set/count.pass.cpp2
-rw-r--r--test/std/containers/associative/set/emplace.pass.cpp2
-rw-r--r--test/std/containers/associative/set/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/associative/set/empty.pass.cpp2
-rw-r--r--test/std/containers/associative/set/equal_range.pass.cpp2
-rw-r--r--test/std/containers/associative/set/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/associative/set/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/set/erase_key.pass.cpp2
-rw-r--r--test/std/containers/associative/set/find.pass.cpp2
-rw-r--r--test/std/containers/associative/set/incomplete_type.pass.cpp29
-rw-r--r--test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp29
-rw-r--r--test/std/containers/associative/set/insert_cv.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_iter_cv.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_iter_rv.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_rv.pass.cpp2
-rw-r--r--test/std/containers/associative/set/iterator.pass.cpp2
-rw-r--r--test/std/containers/associative/set/lower_bound.pass.cpp4
-rw-r--r--test/std/containers/associative/set/max_size.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/associative/set/set.cons/default.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/associative/set/set.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/move.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/move_alloc.pass.cpp4
-rw-r--r--test/std/containers/associative/set/set.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/set/set.special/member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.special/non_member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp24
-rw-r--r--test/std/containers/associative/set/size.pass.cpp2
-rw-r--r--test/std/containers/associative/set/types.pass.cpp2
-rw-r--r--test/std/containers/associative/set/upper_bound.pass.cpp4
-rw-r--r--test/std/containers/associative/tree_balance_after_insert.pass.cpp1616
-rw-r--r--test/std/containers/associative/tree_left_rotate.pass.cpp98
-rw-r--r--test/std/containers/associative/tree_remove.pass.cpp1648
-rw-r--r--test/std/containers/associative/tree_right_rotate.pass.cpp98
230 files changed, 1261 insertions, 4342 deletions
diff --git a/test/std/containers/associative/iterator_types.pass.cpp b/test/std/containers/associative/iterator_types.pass.cpp
new file mode 100644
index 0000000000000..2026219d86cb8
--- /dev/null
+++ b/test/std/containers/associative/iterator_types.pass.cpp
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <map>
+#include <set>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+#include "test_allocator.h"
+
+
+template <class Map, class ValueTp, class PtrT, class CPtrT>
+void testMap() {
+ typedef typename Map::difference_type Diff;
+ {
+ typedef typename Map::iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp&>::value), "");
+ static_assert((std::is_same<typename It::pointer, PtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+ {
+ typedef typename Map::const_iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
+ static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+}
+
+
+template <class Set, class ValueTp, class CPtrT>
+void testSet() {
+ static_assert((std::is_same<typename Set::iterator,
+ typename Set::const_iterator>::value), "");
+ typedef typename Set::difference_type Diff;
+ {
+ typedef typename Set::iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
+ static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+
+ }
+}
+
+int main() {
+ {
+ typedef std::map<int, int> Map;
+ typedef std::pair<const int, int> ValueTp;
+ testMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::map<int, int, std::less<int>, Alloc> Map;
+ testMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::map<int, int, std::less<int>, Alloc> Map;
+ testMap<Map, ValueTp, min_pointer<ValueTp>, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef std::multimap<int, int> Map;
+ typedef std::pair<const int, int> ValueTp;
+ testMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::multimap<int, int, std::less<int>, Alloc> Map;
+ testMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::multimap<int, int, std::less<int>, Alloc> Map;
+ testMap<Map, ValueTp, min_pointer<ValueTp>, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef int ValueTp;
+ typedef std::set<ValueTp> Set;
+ testSet<Set, ValueTp, ValueTp const*>();
+ }
+ {
+ typedef int ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::set<ValueTp, std::less<ValueTp>, Alloc> Set;
+ testSet<Set, ValueTp, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef int ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::set<ValueTp, std::less<ValueTp>, Alloc> Set;
+ testSet<Set, ValueTp, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef int ValueTp;
+ typedef std::multiset<ValueTp> Set;
+ testSet<Set, ValueTp, ValueTp const*>();
+ }
+ {
+ typedef int ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::multiset<ValueTp, std::less<ValueTp>, Alloc> Set;
+ testSet<Set, ValueTp, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef int ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::multiset<ValueTp, std::less<ValueTp>, Alloc> Set;
+ testSet<Set, ValueTp, min_pointer<const ValueTp>>();
+ }
+#endif
+}
diff --git a/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp b/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
new file mode 100644
index 0000000000000..32d34d90d7f80
--- /dev/null
+++ b/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// RUN: %build -O2
+// RUN: %run
+
+// <map>
+
+// Previously this code caused a segfault when compiled at -O2 due to undefined
+// behavior in __tree. See https://llvm.org/bugs/show_bug.cgi?id=28469
+
+#include <functional>
+#include <map>
+
+void dummy() {}
+
+struct F {
+ std::map<int, std::function<void()> > m;
+ F() { m[42] = &dummy; }
+};
+
+int main() {
+ F f;
+ f = F();
+}
diff --git a/test/std/containers/associative/map/compare.pass.cpp b/test/std/containers/associative/map/compare.pass.cpp
index 26ac7af7d908d..9d1c13d7b8e63 100644
--- a/test/std/containers/associative/map/compare.pass.cpp
+++ b/test/std/containers/associative/map/compare.pass.cpp
@@ -44,7 +44,7 @@ int main()
MapT map;
IterBool result = map.insert(std::make_pair(Key(0), 42));
assert(result.second);
- assert(result.first->second = 42);
+ assert(result.first->second == 42);
IterBool result2 = map.insert(std::make_pair(Key(0), 43));
assert(!result2.second);
assert(map[Key(0)] == 42);
diff --git a/test/std/containers/associative/map/incomplete_type.pass.cpp b/test/std/containers/associative/map/incomplete_type.pass.cpp
new file mode 100644
index 0000000000000..84c2451ce0872
--- /dev/null
+++ b/test/std/containers/associative/map/incomplete_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// Check that std::map and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <map>
+
+struct A {
+ typedef std::map<A, A> Map;
+ int data;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+int main() {
+ A a;
+}
diff --git a/test/std/containers/associative/map/map.access/at.pass.cpp b/test/std/containers/associative/map/map.access/at.pass.cpp
index 0da28507fce39..c5f77bf5f0fb6 100644
--- a/test/std/containers/associative/map/map.access/at.pass.cpp
+++ b/test/std/containers/associative/map/map.access/at.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(m.at(8) == 8.5);
assert(m.size() == 7);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.access/empty.pass.cpp b/test/std/containers/associative/map/map.access/empty.pass.cpp
index b11e94c8042ca..17b9cfd4ec110 100644
--- a/test/std/containers/associative/map/map.access/empty.pass.cpp
+++ b/test/std/containers/associative/map/map.access/empty.pass.cpp
@@ -29,7 +29,7 @@ int main()
m.clear();
assert(m.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/map/map.access/index_key.pass.cpp b/test/std/containers/associative/map/map.access/index_key.pass.cpp
index ab1144c60afda..3b1c21fd5da44 100644
--- a/test/std/containers/associative/map/map.access/index_key.pass.cpp
+++ b/test/std/containers/associative/map/map.access/index_key.pass.cpp
@@ -16,8 +16,13 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
+#include "count_new.hpp"
#include "min_allocator.h"
#include "private_constructor.hpp"
+#if TEST_STD_VER >= 11
+#include "container_test_types.h"
+#endif
int main()
{
@@ -46,7 +51,7 @@ int main()
assert(m[6] == 6.5);
assert(m.size() == 8);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
@@ -73,8 +78,42 @@ int main()
assert(m[6] == 6.5);
assert(m.size() == 8);
}
+ {
+ // Use "container_test_types.h" to check what arguments get passed
+ // to the allocator for operator[]
+ using Container = TCT::map<>;
+ using Key = Container::key_type;
+ using MappedType = Container::mapped_type;
+ using ValueTp = Container::value_type;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ Container c;
+ const Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
+ }
+ {
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
+ }
+ }
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp b/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
index 6511dcc85f531..e5580bca3955d 100644
--- a/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
+++ b/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class map
@@ -17,12 +19,13 @@
#include <cassert>
#include "test_macros.h"
+#include "count_new.hpp"
#include "MoveOnly.h"
#include "min_allocator.h"
+#include "container_test_types.h"
int main()
{
-#if TEST_STD_VER >= 11
{
std::map<MoveOnly, double> m;
assert(m.size() == 0);
@@ -52,5 +55,27 @@ int main()
assert(m[6] == 6.5);
assert(m.size() == 2);
}
-#endif
+ {
+ // Use "container_test_types.h" to check what arguments get passed
+ // to the allocator for operator[]
+ using Container = TCT::map<>;
+ using Key = Container::key_type;
+ using MappedType = Container::mapped_type;
+ using ValueTp = Container::value_type;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key &&>&&, std::tuple<>&&>();
+ MappedType& mref = c[std::move(k)];
+ assert(!cc->unchecked());
+ {
+ Key k2(1);
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[std::move(k2)];
+ assert(&mref == &mref2);
+ }
+ }
+ }
}
diff --git a/test/std/containers/associative/map/map.access/iterator.pass.cpp b/test/std/containers/associative/map/map.access/iterator.pass.cpp
index 552e87d8fc8d3..4f66eb6a8e310 100644
--- a/test/std/containers/associative/map/map.access/iterator.pass.cpp
+++ b/test/std/containers/associative/map/map.access/iterator.pass.cpp
@@ -119,7 +119,7 @@ int main()
assert(i->second == 1);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.access/max_size.pass.cpp b/test/std/containers/associative/map/map.access/max_size.pass.cpp
index 551120d331e17..c67d8b1f674db 100644
--- a/test/std/containers/associative/map/map.access/max_size.pass.cpp
+++ b/test/std/containers/associative/map/map.access/max_size.pass.cpp
@@ -25,7 +25,7 @@ int main()
M m;
assert(m.max_size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/map/map.access/size.pass.cpp b/test/std/containers/associative/map/map.access/size.pass.cpp
index 07c12322a460b..b9d56167a4b04 100644
--- a/test/std/containers/associative/map/map.access/size.pass.cpp
+++ b/test/std/containers/associative/map/map.access/size.pass.cpp
@@ -37,7 +37,7 @@ int main()
m.erase(m.begin());
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/map/map.cons/alloc.pass.cpp b/test/std/containers/associative/map/map.cons/alloc.pass.cpp
index 2292c47ef74ba..6ff102e6873c9 100644
--- a/test/std/containers/associative/map/map.cons/alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/alloc.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
index 482d1acff840c..679600662fda4 100644
--- a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
std::map<int, double, std::less<int>, min_allocator<V>> m =
diff --git a/test/std/containers/associative/map/map.cons/compare.pass.cpp b/test/std/containers/associative/map/map.cons/compare.pass.cpp
index 5a213c8e8b8f6..5d8d5e2525074 100644
--- a/test/std/containers/associative/map/map.cons/compare.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/compare.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
diff --git a/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
index 56b3c3315e084..ea1374a53dac3 100644
--- a/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 0000000000000..81ccba3bbc968
--- /dev/null
+++ b/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// Check that std::map fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::map<int, int, Comp<int> > m;
+}
diff --git a/test/std/containers/associative/map/map.cons/copy.pass.cpp b/test/std/containers/associative/map/map.cons/copy.pass.cpp
index be52741330821..a1de1b13aed27 100644
--- a/test/std/containers/associative/map/map.cons/copy.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/copy.pass.cpp
@@ -92,7 +92,7 @@ int main()
assert(*next(mo.begin(), 2) == V(3, 1));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
index fcbe5976d6da4..8a9f7c86a2c79 100644
--- a/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
@@ -56,7 +56,7 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp b/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
index a1bcb30f42949..fc6641ae34b91 100644
--- a/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
@@ -107,7 +107,7 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/default.pass.cpp b/test/std/containers/associative/map/map.cons/default.pass.cpp
index 1832a32fffb3a..265c59ef24cde 100644
--- a/test/std/containers/associative/map/map.cons/default.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/default.pass.cpp
@@ -25,7 +25,7 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
assert(m.empty());
diff --git a/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
index dedc89bd435ed..817f1207ac949 100644
--- a/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,19 +31,19 @@ struct some_comp
{
typedef T value_type;
some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
@@ -50,5 +53,4 @@ int main()
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
index 9baa19b53d055..efdf5a2ed184e 100644
--- a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
@@ -11,26 +11,24 @@
// ~map() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const noexcept { return false; }
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -48,5 +46,4 @@ int main()
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
index 196943653a145..c55d18f540946 100644
--- a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
@@ -41,7 +41,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
std::map<int, double, std::less<int>, min_allocator<V>> m =
diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
index 08f8a529f030a..3133eb2e0dd6d 100644
--- a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
@@ -42,7 +42,7 @@ int main()
assert(*next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
index 765428a631e5b..1210fe0e49e1a 100644
--- a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(m.key_comp() == C(3));
assert(m.get_allocator() == A(6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
diff --git a/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
index c1029af6889e3..48610f3b3e587 100644
--- a/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
@@ -42,7 +42,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
index 837fa8c6cdeaa..1389f71449c8f 100644
--- a/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
index 67fb5d6447623..42376e2683325 100644
--- a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/move.pass.cpp b/test/std/containers/associative/map/map.cons/move.pass.cpp
index c06f2ee5021bc..2d19b88bdda84 100644
--- a/test/std/containers/associative/map/map.cons/move.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move.pass.cpp
@@ -69,7 +69,7 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef min_allocator<V> A;
diff --git a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
index e5d43f266c08c..4ccf56118aec5 100644
--- a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
@@ -169,7 +169,7 @@ int main()
M m1(I(a1), I(a1+num), C(), A());
assert(Counter_base::gConstructed == num+3);
-
+
M m2(m1);
assert(m2 == m1);
assert(Counter_base::gConstructed == num+6);
@@ -187,9 +187,9 @@ int main()
}
assert(Counter_base::gConstructed == num+3);
}
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
diff --git a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
index 8ae8265cdc123..09b41d3b130b3 100644
--- a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
@@ -144,7 +144,7 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
diff --git a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
index 3b28118b5b1e2..95ddf6dcb82f9 100644
--- a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
@@ -28,11 +30,11 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -50,5 +52,4 @@ int main()
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
index 0f1fd396639e1..1c2a242edf43e 100644
--- a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
@@ -26,11 +28,11 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -48,5 +50,4 @@ int main()
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.modifiers/clear.pass.cpp b/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
index c37499df307a3..1f36a6f10cb0b 100644
--- a/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
m.clear();
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
index 81846c6647c6b..63d014fe8cc53 100644
--- a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
@@ -92,7 +92,7 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
typedef std::pair<M::iterator, bool> R;
diff --git a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
index 15f74b17e7864..319a239525ad0 100644
--- a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
@@ -64,7 +64,7 @@ int main()
assert(m.size() == 1);
assert(m.begin()->first == 2);
assert(m.begin()->second == Emplaceable());
- r = m.emplace_hint(m.end(), std::piecewise_construct,
+ r = m.emplace_hint(m.end(), std::piecewise_construct,
std::forward_as_tuple(1),
std::forward_as_tuple(2, 3.5));
assert(r == m.begin());
@@ -89,7 +89,7 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
typedef M::iterator R;
@@ -130,7 +130,7 @@ int main()
assert(m.size() == 1);
assert(m.begin()->first == 2);
assert(m.begin()->second == Emplaceable());
- r = m.emplace_hint(m.end(), std::piecewise_construct,
+ r = m.emplace_hint(m.end(), std::piecewise_construct,
std::forward_as_tuple(1),
std::forward_as_tuple(2, 3.5));
assert(r == m.begin());
diff --git a/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp b/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
index 15c5ce041b688..cd65c4302af7f 100644
--- a/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
@@ -134,7 +134,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
@@ -242,7 +242,7 @@ int main()
assert(i == m.end());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
index 1b49956d8a5ad..144cfac2ccb5a 100644
--- a/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp b/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
index e41f5129140e6..c1b31e78d3ef8 100644
--- a/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
@@ -145,7 +145,7 @@ int main()
assert(m.size() == 0);
assert(s == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
new file mode 100644
index 0000000000000..d98047d02e7dd
--- /dev/null
+++ b/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// insert(...);
+// emplace(...);
+// emplace_hint(...);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <map>
+
+#include "container_test_types.h"
+#include "../../../map_allocator_requirement_test_templates.h"
+
+int main()
+{
+ testMapInsert<TCT::map<> >();
+ testMapInsertHint<TCT::map<> >();
+ testMapEmplace<TCT::map<> >();
+ testMapEmplaceHint<TCT::map<> >();
+}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
index 3d28242fd3228..e2ffcba375fa6 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
@@ -16,74 +16,57 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
+template <class Container>
+void do_insert_cv_test()
{
- {
- typedef std::map<int, double> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2, 2.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2.5);
-
- r = m.insert(M::value_type(1, 1.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1.5);
+ typedef Container M;
+ typedef std::pair<typename M::iterator, bool> R;
+ typedef typename M::value_type VT;
+ M m;
- r = m.insert(M::value_type(3, 3.5));
- assert(r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
+ const VT v1(2, 2.5);
+ R r = m.insert(v1);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2.5);
- r = m.insert(M::value_type(3, 3.5));
- assert(!r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
- }
-#if __cplusplus >= 201103L
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2, 2.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2.5);
+ const VT v2(1, 1.5);
+ r = m.insert(v2);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1.5);
- r = m.insert(M::value_type(1, 1.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1.5);
+ const VT v3(3, 3.5);
+ r = m.insert(v3);
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
- r = m.insert(M::value_type(3, 3.5));
- assert(r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
+ const VT v4(3, 4.5);
+ r = m.insert(v4);
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
+}
- r = m.insert(M::value_type(3, 3.5));
- assert(!r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
+int main()
+{
+ do_insert_cv_test<std::map<int, double> >();
+#if TEST_STD_VER >= 11
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ do_insert_cv_test<M>();
}
#endif
}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
index ab325ed45bfcc..9cf3f3dcf74fa 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
std::map<int, double, std::less<int>, min_allocator<V>> m =
diff --git a/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
index 278db4631a8ca..0c7e124e0d1c9 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
@@ -16,66 +16,53 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
+template <class Container>
+void do_insert_iter_cv_test()
{
- {
- typedef std::map<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
-
- r = m.insert(m.end(), M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(m.end(), v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
- }
-#if __cplusplus >= 201103L
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+ const VT v2(1, 1.5);
+ r = m.insert(m.end(), v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- r = m.insert(m.end(), M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v3(3, 3.5);
+ r = m.insert(m.end(), v3);
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v4(3, 4.5);
+ r = m.insert(m.end(), v4);
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+}
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+int main()
+{
+ do_insert_iter_cv_test<std::map<int, double> >();
+#if TEST_STD_VER >= 11
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ do_insert_iter_cv_test<M>();
}
#endif
}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
index 964738b4a68aa..edc1a1e2c62bd 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(next(m.begin(), 2)->first == 3);
assert(next(m.begin(), 2)->second == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
index 9db1e5c707327..3edb9c06e7c0d 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class map
@@ -21,70 +23,49 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main()
+template <class Container, class Pair>
+void do_insert_iter_rv_test()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- typedef std::map<int, MoveOnly> M;
- typedef std::pair<int, MoveOnly> P;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), P(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
+ typedef Container M;
+ typedef Pair P;
+ typedef typename M::iterator R;
+ M m;
+ R r = m.insert(m.end(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
- r = m.insert(m.end(), P(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
+ r = m.insert(m.end(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
- r = m.insert(m.end(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
+ r = m.insert(m.end(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.end(), P(3, 4));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+}
+int main()
+{
+ do_insert_iter_rv_test<std::map<int, MoveOnly>, std::pair<int, MoveOnly>>();
+ do_insert_iter_rv_test<std::map<int, MoveOnly>, std::pair<const int, MoveOnly>>();
- r = m.insert(m.end(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
- }
-#if TEST_STD_VER >= 11
{
typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
typedef std::pair<int, MoveOnly> P;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), P(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
-
- r = m.insert(m.end(), P(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert(m.end(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert(m.end(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_iter_rv_test<M, P>();
+ do_insert_iter_rv_test<M, CP>();
}
-#endif
-#if TEST_STD_VER > 14
{
typedef std::map<int, MoveOnly> M;
typedef M::iterator R;
@@ -113,6 +94,5 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif
+
}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
index 484ed06247d17..8689dc7284d53 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <map>
@@ -22,7 +22,6 @@
// template <class M>
// iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
-#include <__config>
#include <map>
#include <cassert>
#include <tuple>
@@ -60,9 +59,6 @@ public:
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
{ // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
typedef std::map<int, Moveable> M;
typedef std::pair<M::iterator, bool> R;
@@ -186,7 +182,4 @@ int main()
assert(r->first.get() == 3); // key
assert(r->second.get() == 5); // value
}
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-} \ No newline at end of file
+}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
index 23eb84d687ff3..503d9291076da 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class map
@@ -22,76 +24,54 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main()
+template <class Container, class Pair>
+void do_insert_rv_test()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- typedef std::map<int, MoveOnly> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2, 2));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2);
+ typedef Container M;
+ typedef Pair P;
+ typedef std::pair<typename M::iterator, bool> R;
+ M m;
+ R r = m.insert(P(2, 2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2);
- r = m.insert(M::value_type(1, 1));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1);
+ r = m.insert(P(1, 1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1);
- r = m.insert(M::value_type(3, 3));
- assert(r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
+ r = m.insert(P(3, 3));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
- r = m.insert(M::value_type(3, 3));
- assert(!r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2, 2));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2);
-
- r = m.insert(M::value_type(1, 1));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1);
+ r = m.insert(P(3, 3));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+}
- r = m.insert(M::value_type(3, 3));
- assert(r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
+int main()
+{
+ do_insert_rv_test<std::map<int, MoveOnly>, std::pair<int, MoveOnly>>();
+ do_insert_rv_test<std::map<int, MoveOnly>, std::pair<const int, MoveOnly>>();
- r = m.insert(M::value_type(3, 3));
- assert(!r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
+ {
+ typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_rv_test<M, P>();
+ do_insert_rv_test<M, CP>();
}
-#endif
-#if TEST_STD_VER > 14
{
typedef std::map<int, MoveOnly> M;
typedef std::pair<M::iterator, bool> R;
@@ -124,6 +104,4 @@ int main()
assert(r.first->first == 3);
assert(r.first->second == 3);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp b/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
index 8e0dd7577bbd6..63704c91440e7 100644
--- a/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <map>
@@ -22,7 +22,6 @@
// template <class... Args>
// iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
-#include <__config>
#include <map>
#include <cassert>
#include <tuple>
@@ -58,9 +57,6 @@ public:
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
{ // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
typedef std::map<int, Moveable> M;
typedef std::pair<M::iterator, bool> R;
@@ -104,7 +100,7 @@ int main()
assert(r.first->second.get() == -1); // value
}
- { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
+ { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
typedef std::map<Moveable, Moveable> M;
typedef std::pair<M::iterator, bool> R;
M m;
@@ -140,7 +136,7 @@ int main()
m.try_emplace ( i, Moveable(i, (double) i));
assert(m.size() == 10);
M::const_iterator it = m.find(2);
-
+
Moveable mv1(3, 3.0);
for (int i=0; i < 20; i += 2)
{
@@ -183,7 +179,4 @@ int main()
assert(r->first.get() == 3); // key
assert(r->second.get() == 4); // value
}
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/map/map.ops/count.pass.cpp b/test/std/containers/associative/map/map.ops/count.pass.cpp
index ae87ae8345e97..f3df31951c793 100644
--- a/test/std/containers/associative/map/map.ops/count.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/count.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(r == 0);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
diff --git a/test/std/containers/associative/map/map.ops/count0.pass.cpp b/test/std/containers/associative/map/map.ops/count0.pass.cpp
index ce549366e7ab0..0278343006a87 100644
--- a/test/std/containers/associative/map/map.ops/count0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/count0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/count1.fail.cpp b/test/std/containers/associative/map/map.ops/count1.fail.cpp
index 9c15059d490eb..075a5ba2e0ab0 100644
--- a/test/std/containers/associative/map/map.ops/count1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/count2.fail.cpp b/test/std/containers/associative/map/map.ops/count2.fail.cpp
index 7aa1553ef47a9..de18990218059 100644
--- a/test/std/containers/associative/map/map.ops/count2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/count3.fail.cpp b/test/std/containers/associative/map/map.ops/count3.fail.cpp
index 7e7bb8f6d3709..b139689fec74c 100644
--- a/test/std/containers/associative/map/map.ops/count3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/equal_range.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
index a71149a472125..8beeb8b30f587 100644
--- a/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
@@ -159,7 +159,7 @@ int main()
assert(r.second == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
diff --git a/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
index c95c3dffa9a55..3b98426868e4b 100644
--- a/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
index 8f0da08eb3221..c66c2c512142d 100644
--- a/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
index e73122d6533b9..85083d4f47965 100644
--- a/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
index bb72e9e7a6d43..c9f1126e5baf4 100644
--- a/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/find.pass.cpp b/test/std/containers/associative/map/map.ops/find.pass.cpp
index 17463b65740f2..225f0f406042b 100644
--- a/test/std/containers/associative/map/map.ops/find.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/find.pass.cpp
@@ -93,7 +93,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
diff --git a/test/std/containers/associative/map/map.ops/find0.pass.cpp b/test/std/containers/associative/map/map.ops/find0.pass.cpp
index 5f310b07c599d..d7de579d8b44f 100644
--- a/test/std/containers/associative/map/map.ops/find0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/find0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/find1.fail.cpp b/test/std/containers/associative/map/map.ops/find1.fail.cpp
index c33b5a9a34cf8..4fe61117613c2 100644
--- a/test/std/containers/associative/map/map.ops/find1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/find2.fail.cpp b/test/std/containers/associative/map/map.ops/find2.fail.cpp
index 40bf323a45384..3532dc8765b34 100644
--- a/test/std/containers/associative/map/map.ops/find2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/find3.fail.cpp b/test/std/containers/associative/map/map.ops/find3.fail.cpp
index 9526c0e24d9ec..be77330a29c88 100644
--- a/test/std/containers/associative/map/map.ops/find3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp b/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
index 3cbfbf7d869f2..e4359fa548b96 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
@@ -125,7 +125,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
@@ -317,7 +317,7 @@ int main()
r = m.lower_bound(C2Int(20));
assert(r == next(m.begin(), 8));
}
-
+
{
typedef PrivateConstructor PC;
typedef std::map<PC, double, std::less<>> M;
diff --git a/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp b/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
index 2fc095a8f2c1d..ea121df730022 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
index a4a986c1a7a43..97bbf553205f2 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
index 3f6380e5e25ff..eeae8e657387a 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
index 18f2c7b71fde6..ba27ae3c51723 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp b/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
index 037ceb962cd8d..8c721947a2c3b 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
@@ -124,7 +124,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
@@ -280,7 +280,7 @@ int main()
r = m.upper_bound(20);
assert(r == next(m.begin(), 8));
}
-
+
{
typedef PrivateConstructor PC;
typedef std::map<PC, double, std::less<>> M;
diff --git a/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp b/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
index c58e55f297933..2e597b85cf0c5 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
index 4647681b5cd19..6568e04bfad45 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
index 11852fe0cc9ff..bbb857e6f25ac 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
index 9cddeb8acbdc8..ed9a41e4f03f7 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.special/member_swap.pass.cpp b/test/std/containers/associative/map/map.special/member_swap.pass.cpp
index 7c3ad9d50ae41..f0913a77c2eb9 100644
--- a/test/std/containers/associative/map/map.special/member_swap.pass.cpp
+++ b/test/std/containers/associative/map/map.special/member_swap.pass.cpp
@@ -96,7 +96,7 @@ int main()
assert(m2 == m1_save);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
diff --git a/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp b/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
index b042a4878f8a2..103a57b17e073 100644
--- a/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
@@ -98,6 +98,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef test_allocator<V> A;
typedef test_compare<std::less<int> > C;
@@ -166,8 +167,7 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(1));
}
- }
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
@@ -242,6 +242,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef min_allocator<V> A;
typedef test_compare<std::less<int> > C;
@@ -276,6 +277,5 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A());
}
- }
#endif
}
diff --git a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
index f25dff2c86daa..cbbf4577ce626 100644
--- a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// void swap(map& c)
@@ -15,13 +17,14 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
// This tests a conforming extension
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,23 +32,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
- void deallocate(void*, unsigned) {}
-
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -57,7 +57,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -69,7 +69,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -82,7 +82,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -93,7 +93,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -145,5 +144,4 @@ int main()
}
#endif
-#endif
}
diff --git a/test/std/containers/associative/map/types.pass.cpp b/test/std/containers/associative/map/types.pass.cpp
index d117deff693d1..67cd5acaae89a 100644
--- a/test/std/containers/associative/map/types.pass.cpp
+++ b/test/std/containers/associative/map/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
diff --git a/test/std/containers/associative/multimap/empty.pass.cpp b/test/std/containers/associative/multimap/empty.pass.cpp
index 2384960d10dbd..f1388d8bfa5a2 100644
--- a/test/std/containers/associative/multimap/empty.pass.cpp
+++ b/test/std/containers/associative/multimap/empty.pass.cpp
@@ -29,7 +29,7 @@ int main()
m.clear();
assert(m.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/multimap/incomplete_type.pass.cpp b/test/std/containers/associative/multimap/incomplete_type.pass.cpp
new file mode 100644
index 0000000000000..c461eb38139d5
--- /dev/null
+++ b/test/std/containers/associative/multimap/incomplete_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// Check that std::multimap and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <map>
+
+struct A {
+ typedef std::multimap<A, A> Map;
+ int data;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+int main() {
+ A a;
+}
diff --git a/test/std/containers/associative/multimap/iterator.pass.cpp b/test/std/containers/associative/multimap/iterator.pass.cpp
index 2763129acc2ab..ef7c5ef18af1f 100644
--- a/test/std/containers/associative/multimap/iterator.pass.cpp
+++ b/test/std/containers/associative/multimap/iterator.pass.cpp
@@ -121,7 +121,7 @@ int main()
assert(i->second == d);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/max_size.pass.cpp b/test/std/containers/associative/multimap/max_size.pass.cpp
index ccd8b10638c19..b7cf226d8f138 100644
--- a/test/std/containers/associative/multimap/max_size.pass.cpp
+++ b/test/std/containers/associative/multimap/max_size.pass.cpp
@@ -25,7 +25,7 @@ int main()
M m;
assert(m.max_size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
index 87bf0447e5be5..69660fcd2772e 100644
--- a/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
index 0c89918325297..4c0326d90fe67 100644
--- a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
index 9a4e0f987fd00..59a972f456874 100644
--- a/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
std::multimap<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
diff --git a/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
index 1224884939cfa..836532892499a 100644
--- a/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 0000000000000..e6f6c3efee5bb
--- /dev/null
+++ b/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// Check that std::multimap fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::multimap<int, int, Comp<int> > m;
+}
diff --git a/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
index 3d6626eaadbb0..97dcf39e10c9c 100644
--- a/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
@@ -74,7 +74,7 @@ int main()
assert(mo.key_comp() == C(5));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
index 22594e32d7188..46b9459cad28d 100644
--- a/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(mo.get_allocator() == A(7));
assert(mo.key_comp() == C(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
index 2bdc4d6a70ab5..b0bf8cc135f24 100644
--- a/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
@@ -94,7 +94,7 @@ int main()
assert(mo.get_allocator() == A(2));
assert(mo.key_comp() == C(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
index 1c3ab8ce6c4b0..d39cc1d0ee8af 100644
--- a/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
@@ -25,7 +25,7 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
assert(m.empty());
diff --git a/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
index 5f05a0dca28e1..6f97a5f3e7567 100644
--- a/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,19 +31,19 @@ struct some_comp
{
typedef T value_type;
some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
@@ -50,5 +53,4 @@ int main()
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
index dd1701240c630..3a240cd48af32 100644
--- a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
@@ -11,26 +11,24 @@
// ~multimap() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -48,5 +46,4 @@ int main()
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
index 937a202a55ea0..6f645b63b44cc 100644
--- a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
index e6677039c90c8..6d20d14f42000 100644
--- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
@@ -53,7 +53,7 @@ int main()
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > Cmp;
typedef std::multimap<int, double, Cmp, min_allocator<std::pair<const int, double>>> C;
diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
index 0e73f72793e56..f5d3463aec427 100644
--- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
@@ -57,7 +57,7 @@ int main()
assert(m.get_allocator() == A(5));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > Cmp;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
index fa062e2be0b8f..46c56aa0b3ff5 100644
--- a/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
index d6de59428dd6a..614b3ed8a754e 100644
--- a/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
index 259fbd145ff6d..31bf72dac96f6 100644
--- a/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
@@ -55,7 +55,7 @@ int main()
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
index aed08867c3ccf..7edec77365d8a 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
@@ -75,7 +75,7 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef min_allocator<V> A;
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
index 3ec79eea3554f..41771f62aaeaa 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
@@ -169,7 +169,7 @@ int main()
M m1(I(a1), I(a1+num), C(), A());
assert(Counter_base::gConstructed == 2*num);
-
+
M m2(m1);
assert(m2 == m1);
assert(Counter_base::gConstructed == 3*num);
@@ -187,9 +187,9 @@ int main()
}
assert(Counter_base::gConstructed == 2*num);
}
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
index 48854e388e10a..924e9ddf1936b 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
@@ -144,7 +144,7 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
index 635a8dca03574..890cac867f9e9 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
@@ -28,11 +30,11 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -50,5 +52,4 @@ int main()
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
index 0f31f04ff829d..8932b4f83d482 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
@@ -26,11 +28,11 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -48,5 +50,4 @@ int main()
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
index fe9b8c8ba1287..321f4d0bd000c 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
m.clear();
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
index 03da4af593720..7f5b698fa0681 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
@@ -84,7 +84,7 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
index 846d5999a17ee..a6ed318c75982 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
@@ -89,7 +89,7 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
index ba55351c0bde1..6729da41378bb 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
@@ -155,7 +155,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
@@ -284,7 +284,7 @@ int main()
assert(i == m.end());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
index 4d3789493110b..1069542c5430e 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
index 33821d3e35962..44a6abef6ed00 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
@@ -84,7 +84,7 @@ int main()
assert(m.size() == 0);
assert(i == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/version.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
index b2e3fa43e7879..225bf67bb1f6e 100644
--- a/test/std/containers/associative/map/version.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
@@ -9,12 +9,20 @@
// <map>
+// class multimap
+
+// insert(...)
+
+// UNSUPPORTED: c++98, c++03
+
#include <map>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
+#include "container_test_types.h"
+#include "../../../map_allocator_requirement_test_templates.h"
+
int main()
{
+ testMultimapInsert<TCT::multimap<> >();
+ testMultimapInsertHint<TCT::multimap<> >();
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
index d9afc9d0fdf0e..53874311c7826 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
@@ -16,66 +16,54 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
-{
- {
- typedef std::multimap<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+template <class Container>
+void do_insert_test() {
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- r = m.insert(M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v2(1, 1.5);
+ r = m.insert(v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- r = m.insert(M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v3(3, 3.5);
+ r = m.insert(v3);
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- r = m.insert(M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v4(3, 3.5);
+ r = m.insert(v4);
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+}
+
+int main()
+{
+ {
+ typedef std::multimap<int, double> Container;
+ do_insert_test<Container>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
-
- r = m.insert(M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
-
- r = m.insert(M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
-
- r = m.insert(M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> Container;
+ do_insert_test<Container>();
}
#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
index 5e1a1d4125ef4..89befb3e99719 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
@@ -53,7 +53,7 @@ int main()
assert(*++i == V(3, 2));
assert(*++i == V(3, 1.5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
index b83c802c04cf6..05e1096cb547d 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
@@ -16,66 +16,52 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
+template <class Container>
+void do_insert_hint_test()
{
- {
- typedef std::multimap<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(m.end(), v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- r = m.insert(m.end(), M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v2(1, 1.5);
+ r = m.insert(m.end(), v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v3(3, 3.5);
+ r = m.insert(m.end(), v3);
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- r = m.insert(prev(m.end()), M::value_type(3, 4.5));
- assert(r == prev(m.end(), 2));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 4.5);
- }
-#if __cplusplus >= 201103L
+ const VT v4(3, 4.5);
+ r = m.insert(prev(m.end()), v4);
+ assert(r == prev(m.end(), 2));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 4.5);
+}
+
+int main()
+{
+ do_insert_hint_test<std::multimap<int, double> >();
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
-
- r = m.insert(m.end(), M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
-
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
-
- r = m.insert(prev(m.end()), M::value_type(3, 4.5));
- assert(r == prev(m.end(), 2));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 4.5);
+ do_insert_hint_test<M>();
}
#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
index 70ff7ef6d6b89..1bf437a934438 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(next(m.begin(), 8)->first == 3);
assert(next(m.begin(), 8)->second == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
index 7035de83f9905..47e0d371bb485 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class multimap
@@ -21,73 +23,53 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main()
+template <class Container, class Pair>
+void do_insert_rv_test()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- typedef std::multimap<int, MoveOnly> M;
- typedef std::pair<int, MoveOnly> P;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), P(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
+ typedef Container M;
+ typedef Pair P;
+ typedef typename M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
- r = m.insert(m.cend(), P(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
+ r = m.insert(m.cend(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
- r = m.insert(m.cend(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
+ r = m.insert(m.cend(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.cend(), P(3, 2));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 2);
+}
+
+int main()
+{
+ do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<int, MoveOnly> >();
+ do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<const int, MoveOnly> >();
- r = m.insert(m.cend(), P(3, 2));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 2);
- }
-#if TEST_STD_VER >= 11
{
typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
typedef std::pair<int, MoveOnly> P;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), P(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_rv_test<M, P>();
+ do_insert_rv_test<M, CP>();
- r = m.insert(m.cend(), P(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert(m.cend(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert(m.cend(), P(3, 2));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 2);
}
-#endif
-#if TEST_STD_VER > 14
{
typedef std::multimap<int, MoveOnly> M;
- typedef std::pair<int, MoveOnly> P;
typedef M::iterator R;
M m;
R r = m.insert(m.cend(), {2, MoveOnly(2)});
@@ -114,6 +96,4 @@ int main()
assert(r->first == 3);
assert(r->second == 2);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
index 825e304f65a81..022de873f7f1f 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class multimap
@@ -21,68 +23,45 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main()
+template <class Container>
+void do_insert_rv_test()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- typedef std::multimap<int, MoveOnly> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
+ typedef std::multimap<int, MoveOnly> M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ R r = m.insert(VT(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
- r = m.insert(M::value_type(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
+ r = m.insert(VT(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
- r = m.insert(M::value_type(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
+ r = m.insert(VT(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
- r = m.insert(M::value_type(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3);
- }
-#if TEST_STD_VER >= 11
+ r = m.insert(VT(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3);
+}
+
+int main()
+{
+ do_insert_rv_test<std::multimap<int, MoveOnly>>();
{
typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
-
- r = m.insert(M::value_type(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert(M::value_type(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert(M::value_type(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3);
+ do_insert_rv_test<M>();
}
-#endif
-#if TEST_STD_VER > 14
{
typedef std::multimap<int, MoveOnly> M;
typedef M::iterator R;
@@ -111,6 +90,4 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
index c666c295f3a07..92f90f551d44f 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
@@ -56,7 +56,7 @@ int main()
assert(r == 0);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
index 7da13bb0d66dc..b993f4f89087d 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
index f30d1bfd88d62..d0f3f1c0fdb70 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
index ffb7eb6a559a6..86d492f7f5e08 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
index 4bb9d14634f31..55095efb3d6a0 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
index 5a071042461a7..31eac26816ac3 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
@@ -101,7 +101,7 @@ int main()
assert(r.second == m.end());
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
index c0f07468ec5ed..a3a51e6ccbf91 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
index f022e94324fd9..f793bf8859ba2 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
index 695e71703e3b9..d099a8c81a1b9 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
index 59c2855e8f695..e53fff9427931 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
index a60e42cf8592d..2fd8c05b5f5e2 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
@@ -83,7 +83,7 @@ int main()
assert(r == m.end());
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
index 4f3369870c8f2..03a6e18830510 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
index e1eef034064d0..2759af46be144 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
index 4c03f583fa1c0..c67f3b39dabd7 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
index f10bc60aa8641..e53fc4d558870 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
index 38b931802f8e4..5c0315f956a8d 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
@@ -87,7 +87,7 @@ int main()
assert(r == m.end());
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
index c5271f65d7e51..77927bb5abeda 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
index b452be864e2bc..9b39573a5f42c 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
index a2ba30236a40d..68710bd1bc38d 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
index 50d9fca91ad90..f254ef4785a1a 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
index 7c647a9426cbe..012354cef7bbf 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
@@ -87,7 +87,7 @@ int main()
assert(r == m.end());
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
index 322c6f55130c8..3f6852d085c36 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
index bb78ad6981601..d47d7bfc89f47 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
index a79d5938e56e4..a3da9d82c95c5 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
index 1c1dc74b72c79..6ffdb206cc30c 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp b/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
index fb17e7340bd4f..f216f9f76a11d 100644
--- a/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
@@ -96,7 +96,7 @@ int main()
assert(m2 == m1_save);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp b/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
index a91dfebb14a9d..a075919bba9aa 100644
--- a/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
@@ -98,6 +98,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef test_allocator<V> A;
typedef test_compare<std::less<int> > C;
@@ -166,8 +167,7 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(1));
}
- }
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
@@ -242,6 +242,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef min_allocator<V> A;
typedef test_compare<std::less<int> > C;
@@ -276,6 +277,5 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A());
}
- }
#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
index e70ee1fae565c..ffc71b0eeb924 100644
--- a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// void swap(multimap& c)
@@ -15,13 +17,14 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
// This tests a conforming extension
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,23 +32,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
- void deallocate(void*, unsigned) {}
-
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -57,7 +57,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -69,7 +69,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -82,7 +82,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -93,7 +93,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -144,6 +143,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/associative/multimap/size.pass.cpp b/test/std/containers/associative/multimap/size.pass.cpp
index ac71d4c95b641..7ba7ceb2be6e0 100644
--- a/test/std/containers/associative/multimap/size.pass.cpp
+++ b/test/std/containers/associative/multimap/size.pass.cpp
@@ -37,7 +37,7 @@ int main()
m.erase(m.begin());
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/multimap/types.pass.cpp b/test/std/containers/associative/multimap/types.pass.cpp
index a0f4db056a83b..999ecbb7c2236 100644
--- a/test/std/containers/associative/multimap/types.pass.cpp
+++ b/test/std/containers/associative/multimap/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
diff --git a/test/std/containers/associative/multiset/clear.pass.cpp b/test/std/containers/associative/multiset/clear.pass.cpp
index 3069de5a300d9..f762ef7d35044 100644
--- a/test/std/containers/associative/multiset/clear.pass.cpp
+++ b/test/std/containers/associative/multiset/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
m.clear();
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/multiset/count.pass.cpp b/test/std/containers/associative/multiset/count.pass.cpp
index 93bd6f80eaad2..997a949388cf0 100644
--- a/test/std/containers/associative/multiset/count.pass.cpp
+++ b/test/std/containers/associative/multiset/count.pass.cpp
@@ -55,7 +55,7 @@ int main()
assert(r == 0);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/emplace.pass.cpp b/test/std/containers/associative/multiset/emplace.pass.cpp
index 450ee6cd35a39..93842a250f8ef 100644
--- a/test/std/containers/associative/multiset/emplace.pass.cpp
+++ b/test/std/containers/associative/multiset/emplace.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/emplace_hint.pass.cpp b/test/std/containers/associative/multiset/emplace_hint.pass.cpp
index 194adf761c4c2..48519fd4356a8 100644
--- a/test/std/containers/associative/multiset/emplace_hint.pass.cpp
+++ b/test/std/containers/associative/multiset/emplace_hint.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/empty.pass.cpp b/test/std/containers/associative/multiset/empty.pass.cpp
index 32aef90d41886..acca4e021e0c3 100644
--- a/test/std/containers/associative/multiset/empty.pass.cpp
+++ b/test/std/containers/associative/multiset/empty.pass.cpp
@@ -29,7 +29,7 @@ int main()
m.clear();
assert(m.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/multiset/equal_range.pass.cpp b/test/std/containers/associative/multiset/equal_range.pass.cpp
index 8c69d0c61ec54..7ab95cfb8f67b 100644
--- a/test/std/containers/associative/multiset/equal_range.pass.cpp
+++ b/test/std/containers/associative/multiset/equal_range.pass.cpp
@@ -100,7 +100,7 @@ int main()
assert(r.second == next(m.begin(), 9));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/erase_iter.pass.cpp b/test/std/containers/associative/multiset/erase_iter.pass.cpp
index 1d41540edb8a7..8ee45c64cff09 100644
--- a/test/std/containers/associative/multiset/erase_iter.pass.cpp
+++ b/test/std/containers/associative/multiset/erase_iter.pass.cpp
@@ -106,7 +106,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
@@ -186,7 +186,7 @@ int main()
assert(i == m.end());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp b/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
index e1d7090d816f0..70d3477907e3d 100644
--- a/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
+++ b/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
@@ -78,7 +78,7 @@ int main()
assert(m.size() == 0);
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/multiset/erase_key.pass.cpp b/test/std/containers/associative/multiset/erase_key.pass.cpp
index e9bce1e1b6402..7293bcfb2c358 100644
--- a/test/std/containers/associative/multiset/erase_key.pass.cpp
+++ b/test/std/containers/associative/multiset/erase_key.pass.cpp
@@ -72,7 +72,7 @@ int main()
assert(m.size() == 0);
assert(i == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/multiset/find.pass.cpp b/test/std/containers/associative/multiset/find.pass.cpp
index 364460a6ca3af..3b7d96fe91105 100644
--- a/test/std/containers/associative/multiset/find.pass.cpp
+++ b/test/std/containers/associative/multiset/find.pass.cpp
@@ -92,7 +92,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/incomplete_type.pass.cpp b/test/std/containers/associative/multiset/incomplete_type.pass.cpp
new file mode 100644
index 0000000000000..0355e18f9f296
--- /dev/null
+++ b/test/std/containers/associative/multiset/incomplete_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// Check that std::multiset and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <set>
+
+struct A {
+ typedef std::multiset<A> Set;
+ int data;
+ Set m;
+ Set::iterator it;
+ Set::const_iterator cit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+int main() {
+ A a;
+}
diff --git a/test/std/containers/associative/set/version.pass.cpp b/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp
index c3c4d926e5c33..a280d10d5ab21 100644
--- a/test/std/containers/associative/set/version.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp
@@ -9,12 +9,18 @@
// <set>
+// class multiset
+
+// insert(...)
+
+// UNSUPPORTED: c++98, c++03
+
#include <set>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
+#include "container_test_types.h"
+#include "../../set_allocator_requirement_test_templates.h"
int main()
{
+ testMultisetInsert<TCT::multiset<> >();
}
diff --git a/test/std/containers/associative/multiset/insert_cv.pass.cpp b/test/std/containers/associative/multiset/insert_cv.pass.cpp
index 179715753ab02..2aa920d709725 100644
--- a/test/std/containers/associative/multiset/insert_cv.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_cv.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(m.size() == 4);
assert(*r == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
index 7e923f2516ddc..7b82cea5fbea2 100644
--- a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
@@ -39,7 +39,7 @@ int main()
assert(*++i == V(10));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp b/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
index 7d204024c212b..ca08bacad2f1f 100644
--- a/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(m.size() == 4);
assert(*r == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp b/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
index 189c454986697..fb664d74e4be4 100644
--- a/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
@@ -51,7 +51,7 @@ int main()
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
index ee631f005c931..0afc8dc87c23a 100644
--- a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(*r == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/insert_rv.pass.cpp b/test/std/containers/associative/multiset/insert_rv.pass.cpp
index 29c233e9a119a..3ee464bc5bc72 100644
--- a/test/std/containers/associative/multiset/insert_rv.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_rv.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(*r == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/iterator.pass.cpp b/test/std/containers/associative/multiset/iterator.pass.cpp
index d1f0ecfd6aa06..c152a43981963 100644
--- a/test/std/containers/associative/multiset/iterator.pass.cpp
+++ b/test/std/containers/associative/multiset/iterator.pass.cpp
@@ -70,7 +70,7 @@ int main()
std::multiset<int>::const_iterator k = i;
assert(i == k);
for (int j = 1; j <= 8; ++j)
- for (int k = 0; k < 3; ++k, ++i)
+ for (int n = 0; n < 3; ++n, ++i)
assert(*i == j);
}
{
@@ -113,7 +113,7 @@ int main()
for (int k = 0; k < 3; ++k, ++i)
assert(*i == j);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
@@ -151,7 +151,7 @@ int main()
std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
assert(i == k);
for (int j = 1; j <= 8; ++j)
- for (int k = 0; k < 3; ++k, ++i)
+ for (int n = 0; n < 3; ++n, ++i)
assert(*i == j);
}
{
diff --git a/test/std/containers/associative/multiset/lower_bound.pass.cpp b/test/std/containers/associative/multiset/lower_bound.pass.cpp
index e466791d9356f..ae8cfe6eff4df 100644
--- a/test/std/containers/associative/multiset/lower_bound.pass.cpp
+++ b/test/std/containers/associative/multiset/lower_bound.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(r == next(m.begin(), 9));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/max_size.pass.cpp b/test/std/containers/associative/multiset/max_size.pass.cpp
index 5524f771b341a..79492c9b1c400 100644
--- a/test/std/containers/associative/multiset/max_size.pass.cpp
+++ b/test/std/containers/associative/multiset/max_size.pass.cpp
@@ -25,7 +25,7 @@ int main()
M m;
assert(m.max_size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
index 7d76581d6d8e7..2c5318afd73bf 100644
--- a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
@@ -37,7 +37,7 @@ int main()
assert(*++i == V(6));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 0000000000000..2eade5299d6f0
--- /dev/null
+++ b/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// Check that std::multiset fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::multiset<int, Comp<int> > m;
+}
diff --git a/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
index 5bb0312f012b6..0bc50ab7aaf86 100644
--- a/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
@@ -25,7 +25,7 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::multiset<int, std::less<int>, min_allocator<int>> m;
assert(m.empty());
diff --git a/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
index bf8c53b9ee5d6..15520e7834ff7 100644
--- a/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,18 +31,18 @@ struct some_comp
{
typedef T value_type;
some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
@@ -49,5 +52,4 @@ int main()
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
index fd612c06dbbc1..f4e868ebbc8f1 100644
--- a/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
@@ -11,26 +11,24 @@
// ~multiset() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -47,5 +45,4 @@ int main()
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
index dadafec7c3b1c..7327bf62646b1 100644
--- a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
@@ -36,7 +36,7 @@ int main()
assert(*++i == V(6));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
index f6c1fd76de146..ebe8353bab1fb 100644
--- a/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
index 4ed00c7124cc0..4313f46a03d7f 100644
--- a/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
@@ -24,6 +24,7 @@
int main()
{
+ {
typedef int V;
V ar[] =
{
@@ -55,6 +56,7 @@ int main()
assert(*next(m.begin(), 6) == 3);
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
+ }
#if _LIBCPP_STD_VER > 11
{
typedef int V;
diff --git a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
index 40321cd247e19..5a905cf15a086 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
@@ -77,7 +77,7 @@ int main()
assert(distance(mo.begin(), mo.end()) == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
index 4408208f2ac44..3da3fc09a45f2 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
@@ -163,7 +163,7 @@ int main()
M m1(I(a1), I(a1+num), C(), A());
assert(Counter_base::gConstructed == 2*num);
-
+
M m2(m1);
assert(m2 == m1);
assert(Counter_base::gConstructed == 3*num);
@@ -181,7 +181,7 @@ int main()
}
assert(Counter_base::gConstructed == 2*num);
}
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
index ca1ba971f5a46..b0ec4f39451c0 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
@@ -142,7 +142,7 @@ int main()
assert(m1.empty());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly V;
typedef test_compare<std::less<MoveOnly> > C;
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
index 211bb36e7e953..57388637e97a5 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
@@ -28,11 +30,11 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -49,5 +51,4 @@ int main()
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
index 31a34cbde3061..e3a7beedb92bf 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
@@ -26,11 +28,11 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -47,5 +49,4 @@ int main()
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp b/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
index 7745ddab78c36..7036138f8439f 100644
--- a/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
@@ -96,7 +96,7 @@ int main()
assert(m2 == m1_save);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp b/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
index f456de7f62438..91ec4ce93a27f 100644
--- a/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
@@ -21,6 +21,7 @@
int main()
{
typedef int V;
+ {
typedef std::multiset<int> M;
{
M m1;
@@ -94,6 +95,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef test_allocator<V> A;
typedef test_compare<std::less<int> > C;
diff --git a/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
index 8e2c67c9b5ec6..87639943a0b5a 100644
--- a/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <set>
// void swap(multiset& c)
@@ -15,13 +17,14 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
// This tests a conforming extension
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,23 +32,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
- void deallocate(void*, unsigned) {}
-
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -57,7 +57,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -69,7 +69,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -82,7 +82,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -93,7 +93,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
C c1, c2;
@@ -143,6 +142,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/associative/multiset/size.pass.cpp b/test/std/containers/associative/multiset/size.pass.cpp
index 68099b566dfd4..d11975b79935a 100644
--- a/test/std/containers/associative/multiset/size.pass.cpp
+++ b/test/std/containers/associative/multiset/size.pass.cpp
@@ -37,7 +37,7 @@ int main()
m.erase(m.begin());
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/multiset/types.pass.cpp b/test/std/containers/associative/multiset/types.pass.cpp
index e1e3ad9100c3c..b37b9b328f8fd 100644
--- a/test/std/containers/associative/multiset/types.pass.cpp
+++ b/test/std/containers/associative/multiset/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
diff --git a/test/std/containers/associative/multiset/upper_bound.pass.cpp b/test/std/containers/associative/multiset/upper_bound.pass.cpp
index 7ad3d6ced3d62..7bb0c3cb41f3d 100644
--- a/test/std/containers/associative/multiset/upper_bound.pass.cpp
+++ b/test/std/containers/associative/multiset/upper_bound.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(r == next(m.begin(), 9));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/clear.pass.cpp b/test/std/containers/associative/set/clear.pass.cpp
index 4439ad3b1e4ea..7a5bf4b14a71a 100644
--- a/test/std/containers/associative/set/clear.pass.cpp
+++ b/test/std/containers/associative/set/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
m.clear();
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/set/count.pass.cpp b/test/std/containers/associative/set/count.pass.cpp
index 32fe0b8bcee9c..ddc913910b5e8 100644
--- a/test/std/containers/associative/set/count.pass.cpp
+++ b/test/std/containers/associative/set/count.pass.cpp
@@ -56,7 +56,7 @@ int main()
r = m.count(4);
assert(r == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/emplace.pass.cpp b/test/std/containers/associative/set/emplace.pass.cpp
index 5ebab4d24b92d..47ef455a996bf 100644
--- a/test/std/containers/associative/set/emplace.pass.cpp
+++ b/test/std/containers/associative/set/emplace.pass.cpp
@@ -74,7 +74,7 @@ int main()
assert(m.size() == 1);
assert(*r.first == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef std::pair<M::iterator, bool> R;
diff --git a/test/std/containers/associative/set/emplace_hint.pass.cpp b/test/std/containers/associative/set/emplace_hint.pass.cpp
index 5fdeb4ffef3aa..036f4d6dfb68c 100644
--- a/test/std/containers/associative/set/emplace_hint.pass.cpp
+++ b/test/std/containers/associative/set/emplace_hint.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/set/empty.pass.cpp b/test/std/containers/associative/set/empty.pass.cpp
index eb1080263f4fe..1eaa8fc905378 100644
--- a/test/std/containers/associative/set/empty.pass.cpp
+++ b/test/std/containers/associative/set/empty.pass.cpp
@@ -29,7 +29,7 @@ int main()
m.clear();
assert(m.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/set/equal_range.pass.cpp b/test/std/containers/associative/set/equal_range.pass.cpp
index 8a180ef492482..ed41f691a4599 100644
--- a/test/std/containers/associative/set/equal_range.pass.cpp
+++ b/test/std/containers/associative/set/equal_range.pass.cpp
@@ -158,7 +158,7 @@ int main()
assert(r.second == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/erase_iter.pass.cpp b/test/std/containers/associative/set/erase_iter.pass.cpp
index 36828be86f284..85be1f5b9c212 100644
--- a/test/std/containers/associative/set/erase_iter.pass.cpp
+++ b/test/std/containers/associative/set/erase_iter.pass.cpp
@@ -106,7 +106,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
@@ -186,7 +186,7 @@ int main()
assert(i == m.end());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/associative/set/erase_iter_iter.pass.cpp b/test/std/containers/associative/set/erase_iter_iter.pass.cpp
index 4799503166550..775e6cea06fab 100644
--- a/test/std/containers/associative/set/erase_iter_iter.pass.cpp
+++ b/test/std/containers/associative/set/erase_iter_iter.pass.cpp
@@ -78,7 +78,7 @@ int main()
assert(m.size() == 0);
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/set/erase_key.pass.cpp b/test/std/containers/associative/set/erase_key.pass.cpp
index 9d92bd70d7001..6fc15d9ccfd47 100644
--- a/test/std/containers/associative/set/erase_key.pass.cpp
+++ b/test/std/containers/associative/set/erase_key.pass.cpp
@@ -109,7 +109,7 @@ int main()
assert(m.size() == 0);
assert(i == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/set/find.pass.cpp b/test/std/containers/associative/set/find.pass.cpp
index d08d2fb1e2450..60f16fcd65d4c 100644
--- a/test/std/containers/associative/set/find.pass.cpp
+++ b/test/std/containers/associative/set/find.pass.cpp
@@ -92,7 +92,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/incomplete_type.pass.cpp b/test/std/containers/associative/set/incomplete_type.pass.cpp
new file mode 100644
index 0000000000000..d3a1d6638d7ec
--- /dev/null
+++ b/test/std/containers/associative/set/incomplete_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// Check that std::set and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <set>
+
+struct A {
+ typedef std::set<A> Set;
+ int data;
+ Set m;
+ Set::iterator it;
+ Set::const_iterator cit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+int main() {
+ A a;
+}
diff --git a/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp b/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
new file mode 100644
index 0000000000000..b14340b1d763f
--- /dev/null
+++ b/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// insert(...)
+// emplace(...)
+// emplace_hint(...)
+
+// UNSUPPORTED: c++98, c++03
+
+#include <set>
+#include "container_test_types.h"
+#include "../../set_allocator_requirement_test_templates.h"
+
+int main()
+{
+ testSetInsert<TCT::set<> >();
+ testSetEmplace<TCT::set<> >();
+ testSetEmplaceHint<TCT::set<> >();
+}
diff --git a/test/std/containers/associative/set/insert_cv.pass.cpp b/test/std/containers/associative/set/insert_cv.pass.cpp
index 18d5c2e033953..8d5290a97af93 100644
--- a/test/std/containers/associative/set/insert_cv.pass.cpp
+++ b/test/std/containers/associative/set/insert_cv.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(m.size() == 3);
assert(*r.first == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef std::pair<M::iterator, bool> R;
diff --git a/test/std/containers/associative/set/insert_initializer_list.pass.cpp b/test/std/containers/associative/set/insert_initializer_list.pass.cpp
index fc6d612b2ebed..60a6e754e17ea 100644
--- a/test/std/containers/associative/set/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/set/insert_initializer_list.pass.cpp
@@ -38,7 +38,7 @@ int main()
assert(*++i == V(8));
assert(*++i == V(10));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/set/insert_iter_cv.pass.cpp b/test/std/containers/associative/set/insert_iter_cv.pass.cpp
index 718e720559f46..12d6402a87c23 100644
--- a/test/std/containers/associative/set/insert_iter_cv.pass.cpp
+++ b/test/std/containers/associative/set/insert_iter_cv.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(m.size() == 3);
assert(*r == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/set/insert_iter_iter.pass.cpp b/test/std/containers/associative/set/insert_iter_iter.pass.cpp
index ff729a0e7b9b0..46edd0db04682 100644
--- a/test/std/containers/associative/set/insert_iter_iter.pass.cpp
+++ b/test/std/containers/associative/set/insert_iter_iter.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/set/insert_iter_rv.pass.cpp b/test/std/containers/associative/set/insert_iter_rv.pass.cpp
index 296ead84914d3..be827d644d264 100644
--- a/test/std/containers/associative/set/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/set/insert_iter_rv.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(m.size() == 3);
assert(*r == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/set/insert_rv.pass.cpp b/test/std/containers/associative/set/insert_rv.pass.cpp
index 32cede1549569..e528ef347b886 100644
--- a/test/std/containers/associative/set/insert_rv.pass.cpp
+++ b/test/std/containers/associative/set/insert_rv.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(m.size() == 3);
assert(*r.first == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
typedef std::pair<M::iterator, bool> R;
diff --git a/test/std/containers/associative/set/iterator.pass.cpp b/test/std/containers/associative/set/iterator.pass.cpp
index ecd950f03a009..c318341ce8599 100644
--- a/test/std/containers/associative/set/iterator.pass.cpp
+++ b/test/std/containers/associative/set/iterator.pass.cpp
@@ -111,7 +111,7 @@ int main()
for (int j = 1; j <= m.size(); ++j, ++i)
assert(*i == j);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/set/lower_bound.pass.cpp b/test/std/containers/associative/set/lower_bound.pass.cpp
index df202f31a4c30..55d49a097ef6c 100644
--- a/test/std/containers/associative/set/lower_bound.pass.cpp
+++ b/test/std/containers/associative/set/lower_bound.pass.cpp
@@ -124,7 +124,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
@@ -281,7 +281,7 @@ int main()
r = m.lower_bound(20);
assert(r == next(m.begin(), 8));
}
-
+
{
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
diff --git a/test/std/containers/associative/set/max_size.pass.cpp b/test/std/containers/associative/set/max_size.pass.cpp
index cde4397c71788..9df6a4157e110 100644
--- a/test/std/containers/associative/set/max_size.pass.cpp
+++ b/test/std/containers/associative/set/max_size.pass.cpp
@@ -25,7 +25,7 @@ int main()
M m;
assert(m.max_size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
index 892ae5a0a799b..70e174a596121 100644
--- a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
@@ -36,7 +36,7 @@ int main()
assert(*++i == V(5));
assert(*++i == V(6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 0000000000000..dcf23effc4436
--- /dev/null
+++ b/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// Check that std::set fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::set<int, Comp<int> > m;
+}
diff --git a/test/std/containers/associative/set/set.cons/default.pass.cpp b/test/std/containers/associative/set/set.cons/default.pass.cpp
index 746a2d1730716..4c924ca70e966 100644
--- a/test/std/containers/associative/set/set.cons/default.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/default.pass.cpp
@@ -25,7 +25,7 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::set<int, std::less<int>, min_allocator<int>> m;
assert(m.empty());
diff --git a/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
index 2156169acbc45..6293c24a43d3f 100644
--- a/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,18 +31,18 @@ struct some_comp
{
typedef T value_type;
some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
@@ -49,5 +52,4 @@ int main()
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
index b554d828d4864..60d1d42c3d9cf 100644
--- a/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
@@ -11,26 +11,24 @@
// ~set() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -47,5 +45,4 @@ int main()
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
index 2ad538e143f8f..5bb5460ddc0d5 100644
--- a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
@@ -35,7 +35,7 @@ int main()
assert(*++i == V(5));
assert(*++i == V(6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp b/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
index 7ca7fe14d6c40..db765bd9e3376 100644
--- a/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
index 5ccb6e5cbcd75..077a749caacac 100644
--- a/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
@@ -28,6 +28,7 @@
int main()
{
+ {
typedef int V;
V ar[] =
{
@@ -53,6 +54,7 @@ int main()
assert(*m.begin() == 1);
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
+ }
#if _LIBCPP_STD_VER > 11
{
typedef int V;
diff --git a/test/std/containers/associative/set/set.cons/move.pass.cpp b/test/std/containers/associative/set/set.cons/move.pass.cpp
index 4026ec70c3e1c..c836d4550203e 100644
--- a/test/std/containers/associative/set/set.cons/move.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move.pass.cpp
@@ -70,7 +70,7 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
index 799f0e402d63b..ba2adf5bb520f 100644
--- a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
@@ -163,7 +163,7 @@ int main()
M m1(I(a1), I(a1+num), C(), A());
assert(Counter_base::gConstructed == 3+num);
-
+
M m2(m1);
assert(m2 == m1);
assert(Counter_base::gConstructed == 6+num);
@@ -181,7 +181,7 @@ int main()
}
assert(Counter_base::gConstructed == 3+num);
}
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
index ed0e77ae17966..07cb4153fa4a1 100644
--- a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
@@ -141,7 +141,7 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly V;
typedef test_compare<std::less<MoveOnly> > C;
diff --git a/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
index 3999c55e9e7c0..3f7d783b76300 100644
--- a/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
@@ -28,11 +30,11 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -49,5 +51,4 @@ int main()
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
index 5ccfed4675c54..72c2f7530a9e5 100644
--- a/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
@@ -26,11 +28,11 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -47,5 +49,4 @@ int main()
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.special/member_swap.pass.cpp b/test/std/containers/associative/set/set.special/member_swap.pass.cpp
index b5129f880afdc..486d5f44291b0 100644
--- a/test/std/containers/associative/set/set.special/member_swap.pass.cpp
+++ b/test/std/containers/associative/set/set.special/member_swap.pass.cpp
@@ -96,7 +96,7 @@ int main()
assert(m2 == m1_save);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp b/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
index 0ac14464c70f3..3d2d7d7d3bbc1 100644
--- a/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
@@ -21,6 +21,7 @@
int main()
{
typedef int V;
+ {
typedef std::set<int> M;
{
M m1;
@@ -94,6 +95,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef test_allocator<V> A;
typedef test_compare<std::less<int> > C;
diff --git a/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp b/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
index 3ec6976127545..0eb7d871b8b48 100644
--- a/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <set>
// void swap(set& c)
@@ -15,13 +17,14 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
// This tests a conforming extension
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,23 +32,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
- void deallocate(void*, unsigned) {}
-
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -57,7 +57,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -69,7 +69,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -82,7 +82,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -93,7 +93,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
C c1, c2;
@@ -144,5 +143,4 @@ int main()
}
#endif
-#endif
}
diff --git a/test/std/containers/associative/set/size.pass.cpp b/test/std/containers/associative/set/size.pass.cpp
index e786547355081..853aeca743660 100644
--- a/test/std/containers/associative/set/size.pass.cpp
+++ b/test/std/containers/associative/set/size.pass.cpp
@@ -37,7 +37,7 @@ int main()
m.erase(m.begin());
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/set/types.pass.cpp b/test/std/containers/associative/set/types.pass.cpp
index 3362c42aee429..f1ce8a7c975c5 100644
--- a/test/std/containers/associative/set/types.pass.cpp
+++ b/test/std/containers/associative/set/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
diff --git a/test/std/containers/associative/set/upper_bound.pass.cpp b/test/std/containers/associative/set/upper_bound.pass.cpp
index 10a28f064698f..9d4ab2805d0db 100644
--- a/test/std/containers/associative/set/upper_bound.pass.cpp
+++ b/test/std/containers/associative/set/upper_bound.pass.cpp
@@ -124,7 +124,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
@@ -281,7 +281,7 @@ int main()
r = m.upper_bound(20);
assert(r == next(m.begin(), 8));
}
-
+
{
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
diff --git a/test/std/containers/associative/tree_balance_after_insert.pass.cpp b/test/std/containers/associative/tree_balance_after_insert.pass.cpp
deleted file mode 100644
index b0a3e74cab0af..0000000000000
--- a/test/std/containers/associative/tree_balance_after_insert.pass.cpp
+++ /dev/null
@@ -1,1616 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// Not a portable test
-
-// Precondition: __root->__is_black_ == true
-// template <class _NodePtr>
-// void
-// __tree_balance_after_insert(_NodePtr __root, _NodePtr __x)
-
-#include <__tree>
-#include <cassert>
-
-struct Node
-{
- Node* __left_;
- Node* __right_;
- Node* __parent_;
- bool __is_black_;
-
- Node() : __left_(), __right_(), __parent_(), __is_black_() {}
-};
-
-void
-test1()
-{
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = 0;
- d.__right_ = 0;
- d.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = 0;
- b.__right_ = &a;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = 0;
- d.__right_ = 0;
- d.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == 0);
- assert(b.__right_ == &a);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = 0;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &a;
- d.__right_ = 0;
- d.__is_black_ = false;
-
- a.__parent_ = &d;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &a);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &d);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = 0;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = 0;
- d.__right_ = &a;
- d.__is_black_ = false;
-
- a.__parent_ = &d;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == &a);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &d);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- Node i;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = &g;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &h;
- d.__right_ = &i;
- d.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = &e;
- a.__right_ = &f;
- a.__is_black_ = false;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &a;
- f.__is_black_ = true;
-
- g.__parent_ = &b;
- g.__is_black_ = true;
-
- h.__parent_ = &d;
- h.__is_black_ = true;
-
- i.__parent_ = &d;
- i.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == &g);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &h);
- assert(d.__right_ == &i);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &e);
- assert(a.__right_ == &f);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- Node i;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &g;
- b.__right_ = &a;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &h;
- d.__right_ = &i;
- d.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = &e;
- a.__right_ = &f;
- a.__is_black_ = false;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &a;
- f.__is_black_ = true;
-
- g.__parent_ = &b;
- g.__is_black_ = true;
-
- h.__parent_ = &d;
- h.__is_black_ = true;
-
- i.__parent_ = &d;
- i.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &g);
- assert(b.__right_ == &a);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &h);
- assert(d.__right_ == &i);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &e);
- assert(a.__right_ == &f);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- Node i;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &g;
- b.__right_ = &h;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &a;
- d.__right_ = &i;
- d.__is_black_ = false;
-
- a.__parent_ = &d;
- a.__left_ = &e;
- a.__right_ = &f;
- a.__is_black_ = false;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &a;
- f.__is_black_ = true;
-
- g.__parent_ = &b;
- g.__is_black_ = true;
-
- h.__parent_ = &b;
- h.__is_black_ = true;
-
- i.__parent_ = &d;
- i.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &g);
- assert(b.__right_ == &h);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &a);
- assert(d.__right_ == &i);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &d);
- assert(a.__left_ == &e);
- assert(a.__right_ == &f);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- Node i;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &g;
- b.__right_ = &h;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &i;
- d.__right_ = &a;
- d.__is_black_ = false;
-
- a.__parent_ = &d;
- a.__left_ = &e;
- a.__right_ = &f;
- a.__is_black_ = false;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &a;
- f.__is_black_ = true;
-
- g.__parent_ = &b;
- g.__is_black_ = true;
-
- h.__parent_ = &b;
- h.__is_black_ = true;
-
- i.__parent_ = &d;
- i.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &g);
- assert(b.__right_ == &h);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &i);
- assert(d.__right_ == &a);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &d);
- assert(a.__left_ == &e);
- assert(a.__right_ == &f);
- assert(a.__is_black_ == false);
- }
-}
-
-void
-test2()
-{
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &a;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- a.__parent_ = &c;
- a.__left_ = 0;
- a.__right_ = &b;
- a.__is_black_ = false;
-
- b.__parent_ = &a;
- b.__left_ = 0;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &a;
-
- a.__parent_ = &root;
- a.__left_ = 0;
- a.__right_ = &c;
- a.__is_black_ = true;
-
- c.__parent_ = &a;
- c.__left_ = &b;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- b.__parent_ = &c;
- b.__left_ = 0;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &a;
- c.__right_ = &g;
- c.__is_black_ = true;
-
- a.__parent_ = &c;
- a.__left_ = &d;
- a.__right_ = &b;
- a.__is_black_ = false;
-
- b.__parent_ = &a;
- b.__left_ = &e;
- b.__right_ = &f;
- b.__is_black_ = false;
-
- d.__parent_ = &a;
- d.__is_black_ = true;
-
- e.__parent_ = &b;
- e.__is_black_ = true;
-
- f.__parent_ = &b;
- f.__is_black_ = true;
-
- g.__parent_ = &c;
- g.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == &f);
- assert(c.__right_ == &g);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &d);
- assert(a.__right_ == &e);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &a);
- assert(d.__is_black_ == true);
-
- assert(e.__parent_ == &a);
- assert(e.__is_black_ == true);
-
- assert(f.__parent_ == &c);
- assert(f.__is_black_ == true);
-
- assert(g.__parent_ == &c);
- assert(g.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
-
- root.__left_ = &a;
-
- a.__parent_ = &root;
- a.__left_ = &d;
- a.__right_ = &c;
- a.__is_black_ = true;
-
- c.__parent_ = &a;
- c.__left_ = &b;
- c.__right_ = &g;
- c.__is_black_ = false;
-
- b.__parent_ = &c;
- b.__left_ = &e;
- b.__right_ = &f;
- b.__is_black_ = false;
-
- d.__parent_ = &a;
- d.__is_black_ = true;
-
- e.__parent_ = &b;
- e.__is_black_ = true;
-
- f.__parent_ = &b;
- f.__is_black_ = true;
-
- g.__parent_ = &c;
- g.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == &f);
- assert(c.__right_ == &g);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &d);
- assert(a.__right_ == &e);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &a);
- assert(d.__is_black_ == true);
-
- assert(e.__parent_ == &a);
- assert(e.__is_black_ == true);
-
- assert(f.__parent_ == &c);
- assert(f.__is_black_ == true);
-
- assert(g.__parent_ == &c);
- assert(g.__is_black_ == true);
- }
-}
-
-void
-test3()
-{
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &a;
-
- a.__parent_ = &root;
- a.__left_ = 0;
- a.__right_ = &b;
- a.__is_black_ = true;
-
- b.__parent_ = &a;
- b.__left_ = 0;
- b.__right_ = &c;
- b.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &g;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = &f;
- b.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = &d;
- a.__right_ = &e;
- a.__is_black_ = false;
-
- d.__parent_ = &a;
- d.__is_black_ = true;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &b;
- f.__is_black_ = true;
-
- g.__parent_ = &c;
- g.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == &f);
- assert(c.__right_ == &g);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &d);
- assert(a.__right_ == &e);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &a);
- assert(d.__is_black_ == true);
-
- assert(e.__parent_ == &a);
- assert(e.__is_black_ == true);
-
- assert(f.__parent_ == &c);
- assert(f.__is_black_ == true);
-
- assert(g.__parent_ == &c);
- assert(g.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
-
- root.__left_ = &a;
-
- a.__parent_ = &root;
- a.__left_ = &d;
- a.__right_ = &b;
- a.__is_black_ = true;
-
- b.__parent_ = &a;
- b.__left_ = &e;
- b.__right_ = &c;
- b.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = &f;
- c.__right_ = &g;
- c.__is_black_ = false;
-
- d.__parent_ = &a;
- d.__is_black_ = true;
-
- e.__parent_ = &b;
- e.__is_black_ = true;
-
- f.__parent_ = &c;
- f.__is_black_ = true;
-
- g.__parent_ = &c;
- g.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == &f);
- assert(c.__right_ == &g);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &d);
- assert(a.__right_ == &e);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &a);
- assert(d.__is_black_ == true);
-
- assert(e.__parent_ == &a);
- assert(e.__is_black_ == true);
-
- assert(f.__parent_ == &c);
- assert(f.__is_black_ == true);
-
- assert(g.__parent_ == &c);
- assert(g.__is_black_ == true);
- }
-}
-
-void
-test4()
-{
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
-
- root.__left_ = &a;
- a.__parent_ = &root;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- a.__right_ = &b;
- b.__parent_ = &a;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == &b);
- assert(a.__is_black_ == true);
-
- assert(b.__parent_ == &a);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == false);
-
- b.__right_ = &c;
- c.__parent_ = &b;
-
- std::__tree_balance_after_insert(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- c.__right_ = &d;
- d.__parent_ = &c;
-
- std::__tree_balance_after_insert(root.__left_, &d);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == false);
-
- d.__right_ = &e;
- e.__parent_ = &d;
-
- std::__tree_balance_after_insert(root.__left_, &e);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &d);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- assert(d.__parent_ == &b);
- assert(d.__left_ == &c);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == true);
-
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == false);
-
- e.__right_ = &f;
- f.__parent_ = &e;
-
- std::__tree_balance_after_insert(root.__left_, &f);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &d);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- assert(d.__parent_ == &b);
- assert(d.__left_ == &c);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == false);
-
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == true);
-
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == false);
-
- f.__right_ = &g;
- g.__parent_ = &f;
-
- std::__tree_balance_after_insert(root.__left_, &g);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &d);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- assert(d.__parent_ == &b);
- assert(d.__left_ == &c);
- assert(d.__right_ == &f);
- assert(d.__is_black_ == false);
-
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- assert(f.__parent_ == &d);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == true);
-
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == false);
-
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == 0);
- assert(g.__is_black_ == false);
-
- g.__right_ = &h;
- h.__parent_ = &g;
-
- std::__tree_balance_after_insert(root.__left_, &h);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__left_ == &b);
- assert(d.__right_ == &f);
- assert(d.__is_black_ == true);
-
- assert(b.__parent_ == &d);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- assert(f.__parent_ == &d);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == false);
-
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
-
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
-}
-
-void
-test5()
-{
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
-
- root.__left_ = &h;
- h.__parent_ = &root;
-
- std::__tree_balance_after_insert(root.__left_, &h);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &h);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(h.__parent_ == &root);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-
- h.__left_ = &g;
- g.__parent_ = &h;
-
- std::__tree_balance_after_insert(root.__left_, &g);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &h);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(h.__parent_ == &root);
- assert(h.__left_ == &g);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-
- assert(g.__parent_ == &h);
- assert(g.__left_ == 0);
- assert(g.__right_ == 0);
- assert(g.__is_black_ == false);
-
- g.__left_ = &f;
- f.__parent_ = &g;
-
- std::__tree_balance_after_insert(root.__left_, &f);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(g.__parent_ == &root);
- assert(g.__left_ == &f);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(f.__parent_ == &g);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == false);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
-
- f.__left_ = &e;
- e.__parent_ = &f;
-
- std::__tree_balance_after_insert(root.__left_, &e);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(g.__parent_ == &root);
- assert(g.__left_ == &f);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(f.__parent_ == &g);
- assert(f.__left_ == &e);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
-
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == false);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-
- e.__left_ = &d;
- d.__parent_ = &e;
-
- std::__tree_balance_after_insert(root.__left_, &d);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(g.__parent_ == &root);
- assert(g.__left_ == &e);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(e.__parent_ == &g);
- assert(e.__left_ == &d);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == true);
-
- assert(d.__parent_ == &e);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == false);
-
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == false);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-
- d.__left_ = &c;
- c.__parent_ = &d;
-
- std::__tree_balance_after_insert(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(g.__parent_ == &root);
- assert(g.__left_ == &e);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(e.__parent_ == &g);
- assert(e.__left_ == &d);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == false);
-
- assert(d.__parent_ == &e);
- assert(d.__left_ == &c);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-
- c.__left_ = &b;
- b.__parent_ = &c;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(g.__parent_ == &root);
- assert(g.__left_ == &e);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(e.__parent_ == &g);
- assert(e.__left_ == &c);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == false);
-
- assert(c.__parent_ == &e);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == false);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == false);
-
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-
- b.__left_ = &a;
- a.__parent_ = &b;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &e);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(e.__parent_ == &root);
- assert(e.__left_ == &c);
- assert(e.__right_ == &g);
- assert(e.__is_black_ == true);
-
- assert(c.__parent_ == &e);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == false);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(g.__parent_ == &e);
- assert(g.__left_ == &f);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == false);
-
- assert(f.__parent_ == &g);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-}
-
-int main()
-{
- test1();
- test2();
- test3();
- test4();
- test5();
-}
diff --git a/test/std/containers/associative/tree_left_rotate.pass.cpp b/test/std/containers/associative/tree_left_rotate.pass.cpp
deleted file mode 100644
index 774cbc6879856..0000000000000
--- a/test/std/containers/associative/tree_left_rotate.pass.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// Not a portable test
-
-// Precondition: __x->__right_ != nullptr
-// template <class _NodePtr>
-// void
-// __tree_left_rotate(_NodePtr __x);
-
-#include <__tree>
-#include <cassert>
-
-struct Node
-{
- Node* __left_;
- Node* __right_;
- Node* __parent_;
-
- Node() : __left_(), __right_(), __parent_() {}
-};
-
-void
-test1()
-{
- Node root;
- Node x;
- Node y;
- root.__left_ = &x;
- x.__left_ = 0;
- x.__right_ = &y;
- x.__parent_ = &root;
- y.__left_ = 0;
- y.__right_ = 0;
- y.__parent_ = &x;
- std::__tree_left_rotate(&x);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &y);
- assert(root.__right_ == 0);
- assert(y.__parent_ == &root);
- assert(y.__left_ == &x);
- assert(y.__right_ == 0);
- assert(x.__parent_ == &y);
- assert(x.__left_ == 0);
- assert(x.__right_ == 0);
-}
-
-void
-test2()
-{
- Node root;
- Node x;
- Node y;
- Node a;
- Node b;
- Node c;
- root.__left_ = &x;
- x.__left_ = &a;
- x.__right_ = &y;
- x.__parent_ = &root;
- y.__left_ = &b;
- y.__right_ = &c;
- y.__parent_ = &x;
- a.__parent_ = &x;
- b.__parent_ = &y;
- c.__parent_ = &y;
- std::__tree_left_rotate(&x);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &y);
- assert(root.__right_ == 0);
- assert(y.__parent_ == &root);
- assert(y.__left_ == &x);
- assert(y.__right_ == &c);
- assert(x.__parent_ == &y);
- assert(x.__left_ == &a);
- assert(x.__right_ == &b);
- assert(a.__parent_ == &x);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(b.__parent_ == &x);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(c.__parent_ == &y);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
-}
-
-int main()
-{
- test1();
- test2();
-}
diff --git a/test/std/containers/associative/tree_remove.pass.cpp b/test/std/containers/associative/tree_remove.pass.cpp
deleted file mode 100644
index fb14bd929e913..0000000000000
--- a/test/std/containers/associative/tree_remove.pass.cpp
+++ /dev/null
@@ -1,1648 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// Not a portable test
-
-// Returns __tree_next(__z)
-// template <class _NodePtr>
-// void
-// __tree_remove(_NodePtr __root, _NodePtr __z)
-
-#include <__tree>
-#include <cassert>
-
-struct Node
-{
- Node* __left_;
- Node* __right_;
- Node* __parent_;
- bool __is_black_;
-
- Node() : __left_(), __right_(), __parent_(), __is_black_() {}
-};
-
-void
-test1()
-{
- {
- // Left
- // Case 1 -> Case 2 -> x is red turned to black
- Node root;
- Node b;
- Node c;
- Node d;
- Node e;
- Node y;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &y;
- b.__right_ = &d;
- b.__is_black_ = true;
-
- y.__parent_ = &b;
- y.__left_ = 0;
- y.__right_ = 0;
- y.__is_black_ = true;
-
- d.__parent_ = &b;
- d.__left_ = &c;
- d.__right_ = &e;
- d.__is_black_ = false;
-
- c.__parent_ = &d;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &d;
- e.__left_ = 0;
- e.__right_ = 0;
- e.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &y);
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__left_ == &b);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == true);
-
- assert(b.__parent_ == &d);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
- }
- {
- // Right
- // Case 1 -> Case 2 -> x is red turned to black
- Node root;
- Node b;
- Node c;
- Node d;
- Node e;
- Node y;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__right_ = &y;
- b.__left_ = &d;
- b.__is_black_ = true;
-
- y.__parent_ = &b;
- y.__right_ = 0;
- y.__left_ = 0;
- y.__is_black_ = true;
-
- d.__parent_ = &b;
- d.__right_ = &c;
- d.__left_ = &e;
- d.__is_black_ = false;
-
- c.__parent_ = &d;
- c.__right_ = 0;
- c.__left_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &d;
- e.__right_ = 0;
- e.__left_ = 0;
- e.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &y);
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__right_ == &b);
- assert(d.__left_ == &e);
- assert(d.__is_black_ == true);
-
- assert(b.__parent_ == &d);
- assert(b.__right_ == 0);
- assert(b.__left_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__right_ == 0);
- assert(c.__left_ == 0);
- assert(c.__is_black_ == false);
-
- assert(e.__parent_ == &d);
- assert(e.__right_ == 0);
- assert(e.__left_ == 0);
- assert(e.__is_black_ == true);
- }
- {
- // Left
- // Case 1 -> Case 3 -> Case 4
- Node root;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node y;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &y;
- b.__right_ = &d;
- b.__is_black_ = true;
-
- y.__parent_ = &b;
- y.__left_ = 0;
- y.__right_ = 0;
- y.__is_black_ = true;
-
- d.__parent_ = &b;
- d.__left_ = &c;
- d.__right_ = &e;
- d.__is_black_ = false;
-
- c.__parent_ = &d;
- c.__left_ = &f;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &d;
- e.__left_ = 0;
- e.__right_ = 0;
- e.__is_black_ = true;
-
- f.__parent_ = &c;
- f.__left_ = 0;
- f.__right_ = 0;
- f.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &y);
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__left_ == &f);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == true);
-
- assert(f.__parent_ == &d);
- assert(f.__left_ == &b);
- assert(f.__right_ == &c);
- assert(f.__is_black_ == false);
-
- assert(b.__parent_ == &f);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &f);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
- }
- {
- // Right
- // Case 1 -> Case 3 -> Case 4
- Node root;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node y;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__right_ = &y;
- b.__left_ = &d;
- b.__is_black_ = true;
-
- y.__parent_ = &b;
- y.__right_ = 0;
- y.__left_ = 0;
- y.__is_black_ = true;
-
- d.__parent_ = &b;
- d.__right_ = &c;
- d.__left_ = &e;
- d.__is_black_ = false;
-
- c.__parent_ = &d;
- c.__right_ = &f;
- c.__left_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &d;
- e.__right_ = 0;
- e.__left_ = 0;
- e.__is_black_ = true;
-
- f.__parent_ = &c;
- f.__right_ = 0;
- f.__left_ = 0;
- f.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &y);
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__right_ == &f);
- assert(d.__left_ == &e);
- assert(d.__is_black_ == true);
-
- assert(f.__parent_ == &d);
- assert(f.__right_ == &b);
- assert(f.__left_ == &c);
- assert(f.__is_black_ == false);
-
- assert(b.__parent_ == &f);
- assert(b.__right_ == 0);
- assert(b.__left_ == 0);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &f);
- assert(c.__right_ == 0);
- assert(c.__left_ == 0);
- assert(c.__is_black_ == true);
-
- assert(e.__parent_ == &d);
- assert(e.__right_ == 0);
- assert(e.__left_ == 0);
- assert(e.__is_black_ == true);
- }
-}
-
-void
-test2()
-{
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &c);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &a);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &c);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &a);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &c);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &a);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &c);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &a);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
-}
-
-void
-test3()
-{
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
-
- root.__left_ = &e;
-
- e.__parent_ = &root;
- e.__left_ = &c;
- e.__right_ = &g;
- e.__is_black_ = true;
-
- c.__parent_ = &e;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = false;
-
- g.__parent_ = &e;
- g.__left_ = &f;
- g.__right_ = &h;
- g.__is_black_ = false;
-
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = 0;
- b.__is_black_ = true;
-
- d.__parent_ = &c;
- d.__left_ = 0;
- d.__right_ = 0;
- d.__is_black_ = true;
-
- f.__parent_ = &g;
- f.__left_ = 0;
- f.__right_ = 0;
- f.__is_black_ = true;
-
- h.__parent_ = &g;
- h.__left_ = 0;
- h.__right_ = 0;
- h.__is_black_ = true;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- assert(std::__tree_invariant(root.__left_));
-
- std::__tree_remove(root.__left_, &h);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &e);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(e.__parent_ == &root);
- assert(e.__left_ == &c);
- assert(e.__right_ == &g);
- assert(e.__is_black_ == true);
-
- assert(c.__parent_ == &e);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == false);
-
- assert(g.__parent_ == &e);
- assert(g.__left_ == &f);
- assert(g.__right_ == 0);
- assert(g.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(f.__parent_ == &g);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &g);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &e);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(e.__parent_ == &root);
- assert(e.__left_ == &c);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == true);
-
- assert(c.__parent_ == &e);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == false);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &f);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &e);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(e.__parent_ == &c);
- assert(e.__left_ == &d);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(d.__parent_ == &e);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &e);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &d);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-}
-
-void
-test4()
-{
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
-
- root.__left_ = &d;
-
- d.__parent_ = &root;
- d.__left_ = &b;
- d.__right_ = &f;
- d.__is_black_ = true;
-
- b.__parent_ = &d;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = false;
-
- f.__parent_ = &d;
- f.__left_ = &e;
- f.__right_ = &g;
- f.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &f;
- e.__left_ = 0;
- e.__right_ = 0;
- e.__is_black_ = true;
-
- g.__parent_ = &f;
- g.__left_ = 0;
- g.__right_ = &h;
- g.__is_black_ = true;
-
- h.__parent_ = &g;
- h.__left_ = 0;
- h.__right_ = 0;
- h.__is_black_ = false;
-
- assert(std::__tree_invariant(root.__left_));
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__left_ == &b);
- assert(d.__right_ == &f);
- assert(d.__is_black_ == true);
-
- assert(b.__parent_ == &d);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(f.__parent_ == &d);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == false);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
-
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__left_ == &c);
- assert(d.__right_ == &f);
- assert(d.__is_black_ == true);
-
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- assert(f.__parent_ == &d);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == false);
-
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
-
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &f);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(f.__parent_ == &root);
- assert(f.__left_ == &d);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == true);
-
- assert(d.__parent_ == &f);
- assert(d.__left_ == 0);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == true);
-
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == false);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &d);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &f);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(f.__parent_ == &root);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == true);
-
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
-
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &e);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(g.__parent_ == &root);
- assert(g.__left_ == &f);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(f.__parent_ == &g);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &f);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(g.__parent_ == &root);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
-
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &g);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &h);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(h.__parent_ == &root);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &h);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-}
-
-int main()
-{
- test1();
- test2();
- test3();
- test4();
-}
diff --git a/test/std/containers/associative/tree_right_rotate.pass.cpp b/test/std/containers/associative/tree_right_rotate.pass.cpp
deleted file mode 100644
index 06ec7b8894525..0000000000000
--- a/test/std/containers/associative/tree_right_rotate.pass.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// Not a portable test
-
-// Precondition: __x->__left_ != nullptr
-// template <class _NodePtr>
-// void
-// __tree_right_rotate(_NodePtr __x);
-
-#include <__tree>
-#include <cassert>
-
-struct Node
-{
- Node* __left_;
- Node* __right_;
- Node* __parent_;
-
- Node() : __left_(), __right_(), __parent_() {}
-};
-
-void
-test1()
-{
- Node root;
- Node x;
- Node y;
- root.__left_ = &x;
- x.__left_ = &y;
- x.__right_ = 0;
- x.__parent_ = &root;
- y.__left_ = 0;
- y.__right_ = 0;
- y.__parent_ = &x;
- std::__tree_right_rotate(&x);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &y);
- assert(root.__right_ == 0);
- assert(y.__parent_ == &root);
- assert(y.__left_ == 0);
- assert(y.__right_ == &x);
- assert(x.__parent_ == &y);
- assert(x.__left_ == 0);
- assert(x.__right_ == 0);
-}
-
-void
-test2()
-{
- Node root;
- Node x;
- Node y;
- Node a;
- Node b;
- Node c;
- root.__left_ = &x;
- x.__left_ = &y;
- x.__right_ = &c;
- x.__parent_ = &root;
- y.__left_ = &a;
- y.__right_ = &b;
- y.__parent_ = &x;
- a.__parent_ = &y;
- b.__parent_ = &y;
- c.__parent_ = &x;
- std::__tree_right_rotate(&x);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &y);
- assert(root.__right_ == 0);
- assert(y.__parent_ == &root);
- assert(y.__left_ == &a);
- assert(y.__right_ == &x);
- assert(x.__parent_ == &y);
- assert(x.__left_ == &b);
- assert(x.__right_ == &c);
- assert(a.__parent_ == &y);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(b.__parent_ == &x);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(c.__parent_ == &x);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
-}
-
-int main()
-{
- test1();
- test2();
-}