diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
| commit | 51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch) | |
| tree | 91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test/std/containers/associative/map/map.cons | |
| parent | bb5e33f003797b67974a8893f7f2930fc51b8210 (diff) | |
Notes
Diffstat (limited to 'test/std/containers/associative/map/map.cons')
22 files changed, 63 insertions, 33 deletions
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 } |
