• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 negation;                        // C++17
14 // template<class B>
15 //   constexpr bool negation_v = negation<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::negation<std::true_type >::value, "" );
26     static_assert ( std::negation<std::false_type>::value, "" );
27 
28     static_assert (!std::negation_v<std::true_type >, "" );
29     static_assert ( std::negation_v<std::false_type>, "" );
30 
31     static_assert (!std::negation<True >::value, "" );
32     static_assert ( std::negation<False>::value, "" );
33 
34     static_assert (!std::negation_v<True >, "" );
35     static_assert ( std::negation_v<False>, "" );
36 
37     static_assert ( std::negation<std::negation<std::true_type >>::value, "" );
38     static_assert (!std::negation<std::negation<std::false_type>>::value, "" );
39 }
40