integral_constant.pass.cpp revision 1387038988ea3c93c9f0adcb62d2725160f07cf2
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// type_traits
11
12// integral_constant
13
14#include <type_traits>
15#include <cassert>
16
17int main()
18{
19    typedef std::integral_constant<int, 5> _5;
20    static_assert(_5::value == 5, "");
21    static_assert((std::is_same<_5::value_type, int>::value), "");
22    static_assert((std::is_same<_5::type, _5>::value), "");
23    static_assert((_5() == 5), "");
24
25    static_assert(std::false_type::value == false, "");
26    static_assert((std::is_same<std::false_type::value_type, bool>::value), "");
27    static_assert((std::is_same<std::false_type::type, std::false_type>::value), "");
28
29    static_assert(std::true_type::value == true, "");
30    static_assert((std::is_same<std::true_type::value_type, bool>::value), "");
31    static_assert((std::is_same<std::true_type::type, std::true_type>::value), "");
32
33    std::false_type f1;
34    std::false_type f2 = f1;
35
36    std::true_type t1;
37    std::true_type t2 = t1;
38}
39