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 // UNSUPPORTED: c++98, c++03, c++11, c++14
11 // type_traits
12
13 // template<class... B> struct disjunction; // C++17
14 // template<class... B>
15 // constexpr bool disjunction_v = disjunction<B...>::value; // C++17
16
17 #include <type_traits>
18 #include <cassert>
19
20 struct True { static constexpr bool value = true; };
21 struct False { static constexpr bool value = false; };
22
main()23 int main()
24 {
25 static_assert (!std::disjunction<>::value, "" );
26 static_assert ( std::disjunction<std::true_type >::value, "" );
27 static_assert (!std::disjunction<std::false_type>::value, "" );
28
29 static_assert (!std::disjunction_v<>, "" );
30 static_assert ( std::disjunction_v<std::true_type >, "" );
31 static_assert (!std::disjunction_v<std::false_type>, "" );
32
33 static_assert ( std::disjunction<std::true_type, std::true_type >::value, "" );
34 static_assert ( std::disjunction<std::true_type, std::false_type>::value, "" );
35 static_assert ( std::disjunction<std::false_type, std::true_type >::value, "" );
36 static_assert (!std::disjunction<std::false_type, std::false_type>::value, "" );
37
38 static_assert ( std::disjunction_v<std::true_type, std::true_type >, "" );
39 static_assert ( std::disjunction_v<std::true_type, std::false_type>, "" );
40 static_assert ( std::disjunction_v<std::false_type, std::true_type >, "" );
41 static_assert (!std::disjunction_v<std::false_type, std::false_type>, "" );
42
43 static_assert ( std::disjunction<std::true_type, std::true_type, std::true_type >::value, "" );
44 static_assert ( std::disjunction<std::true_type, std::false_type, std::true_type >::value, "" );
45 static_assert ( std::disjunction<std::false_type, std::true_type, std::true_type >::value, "" );
46 static_assert ( std::disjunction<std::false_type, std::false_type, std::true_type >::value, "" );
47 static_assert ( std::disjunction<std::true_type, std::true_type, std::false_type>::value, "" );
48 static_assert ( std::disjunction<std::true_type, std::false_type, std::false_type>::value, "" );
49 static_assert ( std::disjunction<std::false_type, std::true_type, std::false_type>::value, "" );
50 static_assert (!std::disjunction<std::false_type, std::false_type, std::false_type>::value, "" );
51
52 static_assert ( std::disjunction_v<std::true_type, std::true_type, std::true_type >, "" );
53 static_assert ( std::disjunction_v<std::true_type, std::false_type, std::true_type >, "" );
54 static_assert ( std::disjunction_v<std::false_type, std::true_type, std::true_type >, "" );
55 static_assert ( std::disjunction_v<std::false_type, std::false_type, std::true_type >, "" );
56 static_assert ( std::disjunction_v<std::true_type, std::true_type, std::false_type>, "" );
57 static_assert ( std::disjunction_v<std::true_type, std::false_type, std::false_type>, "" );
58 static_assert ( std::disjunction_v<std::false_type, std::true_type, std::false_type>, "" );
59 static_assert (!std::disjunction_v<std::false_type, std::false_type, std::false_type>, "" );
60
61 static_assert ( std::disjunction<True >::value, "" );
62 static_assert (!std::disjunction<False>::value, "" );
63
64 static_assert ( std::disjunction_v<True >, "" );
65 static_assert (!std::disjunction_v<False>, "" );
66 }
67