diff options
Diffstat (limited to 'libcxx/test/std/utilities')
7 files changed, 35 insertions, 25 deletions
diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp index 71f39d8deeb..808284261f7 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp @@ -20,6 +20,8 @@ #include <cstdint> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -52,10 +54,10 @@ struct B int main() { -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 A<int> a; assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF))); -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif B<int> b; assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xFEADBEEF))); } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp index 634019758e7..46075f62c6c 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -36,14 +38,14 @@ struct B { typedef T value_type; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 template <class U, class ...Args> void construct(U* p, Args&& ...args) { ++b_construct; ::new ((void*)p) U(std::forward<Args>(args)...); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif }; struct A0 @@ -105,7 +107,7 @@ int main() std::allocator_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5); assert(A2::count == 1); } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 { A0::count = 0; b_construct = 0; @@ -139,5 +141,5 @@ int main() assert(A2::count == 1); assert(b_construct == 1); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp index 54726c929ef..2ee64b8b4a0 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -63,7 +65,7 @@ int main() std::allocator_traits<A<int> >::destroy(a, (A0*)&a0); assert(A0::count == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { A0::count = 0; b_destroy = 0; @@ -76,5 +78,5 @@ int main() assert(A0::count == 1); assert(b_destroy == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp index bbc6b470174..d2c9a9826e1 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp @@ -43,7 +43,15 @@ struct B int main() { -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE + { + B<int> b; + assert(std::allocator_traits<B<int> >::max_size(b) == 100); + } + { + const B<int> b = {}; + assert(std::allocator_traits<B<int> >::max_size(b) == 100); + } +#if TEST_STD_VER >= 11 { A<int> a; assert(std::allocator_traits<A<int> >::max_size(a) == @@ -54,16 +62,6 @@ int main() assert(std::allocator_traits<A<int> >::max_size(a) == std::numeric_limits<std::size_t>::max() / sizeof(int)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE - { - B<int> b; - assert(std::allocator_traits<B<int> >::max_size(b) == 100); - } - { - const B<int> b = {}; - assert(std::allocator_traits<B<int> >::max_size(b) == 100); - } -#if TEST_STD_VER >= 11 { std::allocator<int> a; static_assert(noexcept(std::allocator_traits<std::allocator<int>>::max_size(a)) == true, ""); diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp index 29fe2be126f..2e970303789 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -55,7 +57,7 @@ int main() const A<int> a(0); assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { B<int> b; assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100); @@ -64,5 +66,5 @@ int main() const B<int> b(0); assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp index 87da9a0a85d..af4f5bc3fb4 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp @@ -19,6 +19,8 @@ #include <memory> #include <type_traits> +#include "test_macros.h" + template <class T> struct ReboundA {}; @@ -63,17 +65,17 @@ struct E int main() { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#if TEST_STD_VER >= 11 static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), ""); -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#else static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), ""); -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif } diff --git a/libcxx/test/std/utilities/memory/pointer.traits/rebind.pass.cpp b/libcxx/test/std/utilities/memory/pointer.traits/rebind.pass.cpp index 8716c05f333..4caf4f65029 100644 --- a/libcxx/test/std/utilities/memory/pointer.traits/rebind.pass.cpp +++ b/libcxx/test/std/utilities/memory/pointer.traits/rebind.pass.cpp @@ -19,9 +19,11 @@ #include <memory> #include <type_traits> +#include "test_macros.h" + int main() { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#if TEST_STD_VER >= 11 static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), ""); #else static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), ""); |