9ee89c29cf0f98e4da5b3590a1e74f856ea4837c
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / utilities / meta / meta.unary.prop.query / alignment_of.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // type_traits
11
12 // alignment_of
13
14 #include <type_traits>
15 #include <cstdint>
16
17 template <class T, unsigned A>
18 void test_alignment_of()
19 {
20     static_assert( std::alignment_of<T>::value == A, "");
21     static_assert( std::alignment_of<const T>::value == A, "");
22     static_assert( std::alignment_of<volatile T>::value == A, "");
23     static_assert( std::alignment_of<const volatile T>::value == A, "");
24 }
25
26 class Class
27 {
28 public:
29     ~Class();
30 };
31
32 int main()
33 {
34     test_alignment_of<int&, 4>();
35     test_alignment_of<Class, 1>();
36     test_alignment_of<int*, sizeof(intptr_t)>();
37     test_alignment_of<const int*, sizeof(intptr_t)>();
38     test_alignment_of<char[3], 1>();
39     test_alignment_of<int, 4>();
40     test_alignment_of<double, 8>();
41     test_alignment_of<bool, 1>();
42     test_alignment_of<unsigned, 4>();
43 }