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// 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#ifndef _LIBCPP_HAS_NO_CONSTEXPR
24    static_assert((_5() == 5), "");
25#else
26    assert(_5() == 5);
27#endif
28
29#if _LIBCPP_STD_VER > 11
30    static_assert ( _5{}() == 5, "" );
31    static_assert ( std::true_type{}(), "" );
32#endif
33
34    static_assert(std::false_type::value == false, "");
35    static_assert((std::is_same<std::false_type::value_type, bool>::value), "");
36    static_assert((std::is_same<std::false_type::type, std::false_type>::value), "");
37
38    static_assert(std::true_type::value == true, "");
39    static_assert((std::is_same<std::true_type::value_type, bool>::value), "");
40    static_assert((std::is_same<std::true_type::type, std::true_type>::value), "");
41
42    std::false_type f1;
43    std::false_type f2 = f1;
44
45    std::true_type t1;
46    std::true_type t2 = t1;
47}
48