summaryrefslogtreecommitdiff
path: root/test/std/containers/associative/set
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/associative/set')
-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.cpp (renamed from test/std/containers/associative/set/version.pass.cpp)17
-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
40 files changed, 135 insertions, 65 deletions
diff --git a/test/std/containers/associative/set/clear.pass.cpp b/test/std/containers/associative/set/clear.pass.cpp
index 4439ad3b1e4e..7a5bf4b14a71 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 32fe0b8bcee9..ddc913910b5e 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 5ebab4d24b92..47ef455a996b 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 5fdeb4ffef3a..036f4d6dfb68 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 eb1080263f4f..1eaa8fc90537 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 8a180ef49248..ed41f691a459 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 36828be86f28..85be1f5b9c21 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 479950316655..775e6cea06fa 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 9d92bd70d700..6fc15d9ccfd4 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 d08d2fb1e245..60f16fcd65d4 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 000000000000..d3a1d6638d7e
--- /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/version.pass.cpp b/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
index c3c4d926e5c3..b14340b1d763 100644
--- a/test/std/containers/associative/set/version.pass.cpp
+++ b/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
@@ -9,12 +9,21 @@
// <set>
-#include <set>
+// class set
+
+// insert(...)
+// emplace(...)
+// emplace_hint(...)
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
+// 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 18d5c2e03395..8d5290a97af9 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 fc6d612b2ebe..60a6e754e17e 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 718e720559f4..12d6402a87c2 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 ff729a0e7b9b..46edd0db0468 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 296ead84914d..be827d644d26 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 32cede154956..e528ef347b88 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 ecd950f03a00..c318341ce859 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 df202f31a4c3..55d49a097ef6 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 cde4397c7178..9df6a4157e11 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 892ae5a0a799..70e174a59612 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 000000000000..dcf23effc443
--- /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 746a2d173071..4c924ca70e96 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 2156169acbc4..6293c24a43d3 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 b554d828d486..60d1d42c3d9c 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 2ad538e143f8..5bb5460ddc0d 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 7ca7fe14d6c4..db765bd9e337 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 5ccb6e5cbcd7..077a749caaca 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 4026ec70c3e1..c836d4550203 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 799f0e402d63..ba2adf5bb520 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 ed0e77ae1796..07cb4153fa4a 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 3999c55e9e7c..3f7d783b7630 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 5ccfed4675c5..72c2f7530a9e 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 b5129f880afd..486d5f44291b 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 0ac14464c70f..3d2d7d7d3bbc 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 3ec697612754..0eb7d871b8b4 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 e78654735508..853aeca74366 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 3362c42aee42..f1ce8a7c975c 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 10a28f064698..9d4ab2805d0d 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;