diff options
Diffstat (limited to 'test/std/containers/associative/multiset/multiset.cons')
13 files changed, 54 insertions, 22 deletions
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 } |