1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 #include <type_traits>
19 typedef std::aligned_storage<10, 1 >::type T1;
20 #if _LIBCPP_STD_VER > 11
21 static_assert(std::is_same<std::aligned_storage_t<10, 1>, T1>::value, "" );
23 static_assert(std::alignment_of<T1>::value == 1, "");
24 static_assert(sizeof(T1) == 10, "");
27 typedef std::aligned_storage<10, 2 >::type T1;
28 #if _LIBCPP_STD_VER > 11
29 static_assert(std::is_same<std::aligned_storage_t<10, 2>, T1>::value, "" );
31 static_assert(std::alignment_of<T1>::value == 2, "");
32 static_assert(sizeof(T1) == 10, "");
35 typedef std::aligned_storage<10, 4 >::type T1;
36 #if _LIBCPP_STD_VER > 11
37 static_assert(std::is_same<std::aligned_storage_t<10, 4>, T1>::value, "" );
39 static_assert(std::alignment_of<T1>::value == 4, "");
40 static_assert(sizeof(T1) == 12, "");
43 typedef std::aligned_storage<10, 8 >::type T1;
44 #if _LIBCPP_STD_VER > 11
45 static_assert(std::is_same<std::aligned_storage_t<10, 8>, T1>::value, "" );
47 static_assert(std::alignment_of<T1>::value == 8, "");
48 static_assert(sizeof(T1) == 16, "");
51 typedef std::aligned_storage<10, 16 >::type T1;
52 #if _LIBCPP_STD_VER > 11
53 static_assert(std::is_same<std::aligned_storage_t<10, 16>, T1>::value, "" );
55 static_assert(std::alignment_of<T1>::value == 16, "");
56 static_assert(sizeof(T1) == 16, "");
59 typedef std::aligned_storage<10, 32 >::type T1;
60 #if _LIBCPP_STD_VER > 11
61 static_assert(std::is_same<std::aligned_storage_t<10, 32>, T1>::value, "" );
63 static_assert(std::alignment_of<T1>::value == 32, "");
64 static_assert(sizeof(T1) == 32, "");
67 typedef std::aligned_storage<20, 32 >::type T1;
68 #if _LIBCPP_STD_VER > 11
69 static_assert(std::is_same<std::aligned_storage_t<20, 32>, T1>::value, "" );
71 static_assert(std::alignment_of<T1>::value == 32, "");
72 static_assert(sizeof(T1) == 32, "");
75 typedef std::aligned_storage<40, 32 >::type T1;
76 #if _LIBCPP_STD_VER > 11
77 static_assert(std::is_same<std::aligned_storage_t<40, 32>, T1>::value, "" );
79 static_assert(std::alignment_of<T1>::value == 32, "");
80 static_assert(sizeof(T1) == 64, "");
83 typedef std::aligned_storage<12, 16 >::type T1;
84 #if _LIBCPP_STD_VER > 11
85 static_assert(std::is_same<std::aligned_storage_t<12, 16>, T1>::value, "" );
87 static_assert(std::alignment_of<T1>::value == 16, "");
88 static_assert(sizeof(T1) == 16, "");
91 typedef std::aligned_storage<1>::type T1;
92 #if _LIBCPP_STD_VER > 11
93 static_assert(std::is_same<std::aligned_storage_t<1>, T1>::value, "" );
95 static_assert(std::alignment_of<T1>::value == 1, "");
96 static_assert(sizeof(T1) == 1, "");
99 typedef std::aligned_storage<2>::type T1;
100 #if _LIBCPP_STD_VER > 11
101 static_assert(std::is_same<std::aligned_storage_t<2>, T1>::value, "" );
103 static_assert(std::alignment_of<T1>::value == 2, "");
104 static_assert(sizeof(T1) == 2, "");
107 typedef std::aligned_storage<3>::type T1;
108 #if _LIBCPP_STD_VER > 11
109 static_assert(std::is_same<std::aligned_storage_t<3>, T1>::value, "" );
111 static_assert(std::alignment_of<T1>::value == 2, "");
112 static_assert(sizeof(T1) == 4, "");
115 typedef std::aligned_storage<4>::type T1;
116 #if _LIBCPP_STD_VER > 11
117 static_assert(std::is_same<std::aligned_storage_t<4>, T1>::value, "" );
119 static_assert(std::alignment_of<T1>::value == 4, "");
120 static_assert(sizeof(T1) == 4, "");
123 typedef std::aligned_storage<5>::type T1;
124 #if _LIBCPP_STD_VER > 11
125 static_assert(std::is_same<std::aligned_storage_t<5>, T1>::value, "" );
127 static_assert(std::alignment_of<T1>::value == 4, "");
128 static_assert(sizeof(T1) == 8, "");
131 typedef std::aligned_storage<7>::type T1;
132 #if _LIBCPP_STD_VER > 11
133 static_assert(std::is_same<std::aligned_storage_t<7>, T1>::value, "" );
135 static_assert(std::alignment_of<T1>::value == 4, "");
136 static_assert(sizeof(T1) == 8, "");
139 typedef std::aligned_storage<8>::type T1;
140 #if _LIBCPP_STD_VER > 11
141 static_assert(std::is_same<std::aligned_storage_t<8>, T1>::value, "" );
143 static_assert(std::alignment_of<T1>::value == 8, "");
144 static_assert(sizeof(T1) == 8, "");
147 typedef std::aligned_storage<9>::type T1;
148 #if _LIBCPP_STD_VER > 11
149 static_assert(std::is_same<std::aligned_storage_t<9>, T1>::value, "" );
151 static_assert(std::alignment_of<T1>::value == 8, "");
152 static_assert(sizeof(T1) == 16, "");
155 typedef std::aligned_storage<15>::type T1;
156 #if _LIBCPP_STD_VER > 11
157 static_assert(std::is_same<std::aligned_storage_t<15>, T1>::value, "" );
159 static_assert(std::alignment_of<T1>::value == 8, "");
160 static_assert(sizeof(T1) == 16, "");
162 // Use alignof(std::max_align_t) below to find the max alignment instead of
163 // hardcoding it, because it's different on different platforms.
164 // (For example 8 on arm and 16 on x86.)
165 #if __cplusplus < 201103L
166 #define alignof __alignof__
169 typedef std::aligned_storage<16>::type T1;
170 #if _LIBCPP_STD_VER > 11
171 static_assert(std::is_same<std::aligned_storage_t<16>, T1>::value, "" );
173 static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
175 static_assert(sizeof(T1) == 16, "");
178 typedef std::aligned_storage<17>::type T1;
179 #if _LIBCPP_STD_VER > 11
180 static_assert(std::is_same<std::aligned_storage_t<17>, T1>::value, "" );
182 static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
184 static_assert(sizeof(T1) == 16 + alignof(std::max_align_t), "");
187 typedef std::aligned_storage<10>::type T1;
188 #if _LIBCPP_STD_VER > 11
189 static_assert(std::is_same<std::aligned_storage_t<10>, T1>::value, "" );
191 static_assert(std::alignment_of<T1>::value == 8, "");
192 static_assert(sizeof(T1) == 16, "");