diff options
Diffstat (limited to 'test/std/containers/associative/multiset')
40 files changed, 148 insertions, 62 deletions
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/multiset/insert_allocator_requirements.pass.cpp b/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp new file mode 100644 index 0000000000000..a280d10d5ab21 --- /dev/null +++ b/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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 multiset + +// insert(...) + +// UNSUPPORTED: c++98, c++03 + +#include <set> + +#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; |