[AMDGPU] Mark AGPR tuple implicit in the first instr of AGPR spills. (#115285)
[llvm-project.git] / libcxx / test / std / utilities / memory / allocator.traits / rebind_traits.pass.cpp
blob01aac9445c83854c8e693bcfa97ca64ddd0a0c2d
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <memory>
11 // template <class Alloc>
12 // struct allocator_traits
13 // {
14 // template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
15 // ...
16 // };
18 #include <memory>
19 #include <type_traits>
21 #include "test_macros.h"
23 template <class T>
24 struct ReboundA {};
26 template <class T>
27 struct A
29 typedef T value_type;
31 template <class U> struct rebind {typedef ReboundA<U> other;};
34 template <class T, class U>
35 struct ReboundB {};
37 template <class T, class U>
38 struct B
40 typedef T value_type;
42 template <class V> struct rebind {typedef ReboundB<V, U> other;};
45 template <class T>
46 struct C
48 typedef T value_type;
51 template <class T, class U>
52 struct D
54 typedef T value_type;
57 template <class T>
58 struct E
60 typedef T value_type;
62 template <class U> struct rebind {typedef ReboundA<U> otter;};
65 int main(int, char**)
67 #if TEST_STD_VER >= 11
68 static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), "");
69 static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), "");
70 static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), "");
71 static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), "");
72 static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), "");
73 #else
74 static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), "");
75 static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), "");
76 static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), "");
77 static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), "");
78 static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), "");
79 #endif
81 return 0;