diff options
Diffstat (limited to 'test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp')
-rw-r--r-- | test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp index 50611b99da9a..8097a66fc9d6 100644 --- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp +++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp @@ -19,6 +19,8 @@ #include <memory> #include <type_traits> +#include "test_macros.h" + template <class T> struct ReboundA {}; @@ -61,19 +63,39 @@ struct E template <class U> struct rebind {typedef ReboundA<U> otter;}; }; +template <class T> +struct F { + typedef T value_type; +private: + template <class> + struct rebind { typedef void other; }; +}; + +template <class T> +struct G { + typedef T value_type; + template <class> + struct rebind { + private: + typedef void other; + }; +}; + int main() { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#if TEST_STD_VER >= 11 static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>, ReboundA<double> >::value), ""); static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>, ReboundB<double, char> >::value), ""); static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>, C<double> >::value), ""); static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>, D<double, char> >::value), ""); static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>, E<double> >::value), ""); -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES + static_assert((std::is_same<std::allocator_traits<F<char> >::rebind_alloc<double>, F<double> >::value), ""); + static_assert((std::is_same<std::allocator_traits<G<char> >::rebind_alloc<double>, G<double> >::value), ""); +#else static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>::other, ReboundA<double> >::value), ""); static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>::other, ReboundB<double, char> >::value), ""); static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>::other, C<double> >::value), ""); static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>::other, D<double, char> >::value), ""); static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>::other, E<double> >::value), ""); -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif } |