xref: /llvm-project/libcxx/test/std/utilities/meta/meta.logical/negation.pass.cpp (revision 31cbe0f240f660f15602c96b787c58a26f17e179)
1dd1b261fSMarshall Clow //===----------------------------------------------------------------------===//
2dd1b261fSMarshall Clow //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6dd1b261fSMarshall Clow //
7dd1b261fSMarshall Clow //===----------------------------------------------------------------------===//
8dd1b261fSMarshall Clow 
9*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14
10dd1b261fSMarshall Clow // type_traits
11dd1b261fSMarshall Clow 
12dd1b261fSMarshall Clow // template<class B> struct negation;                        // C++17
13dd1b261fSMarshall Clow // template<class B>
14dd1b261fSMarshall Clow //   constexpr bool negation_v = negation<B>::value;         // C++17
15dd1b261fSMarshall Clow 
16dd1b261fSMarshall Clow #include <type_traits>
17dd1b261fSMarshall Clow #include <cassert>
18dd1b261fSMarshall Clow 
197fc6a556SMarshall Clow #include "test_macros.h"
207fc6a556SMarshall Clow 
21dd1b261fSMarshall Clow struct True  { static constexpr bool value = true; };
22dd1b261fSMarshall Clow struct False { static constexpr bool value = false; };
23dd1b261fSMarshall Clow 
main(int,char **)242df59c50SJF Bastien int main(int, char**)
25dd1b261fSMarshall Clow {
26dd1b261fSMarshall Clow     static_assert (!std::negation<std::true_type >::value, "" );
27dd1b261fSMarshall Clow     static_assert ( std::negation<std::false_type>::value, "" );
28dd1b261fSMarshall Clow 
29dd1b261fSMarshall Clow     static_assert (!std::negation_v<std::true_type >, "" );
30dd1b261fSMarshall Clow     static_assert ( std::negation_v<std::false_type>, "" );
31dd1b261fSMarshall Clow 
32dd1b261fSMarshall Clow     static_assert (!std::negation<True >::value, "" );
33dd1b261fSMarshall Clow     static_assert ( std::negation<False>::value, "" );
34dd1b261fSMarshall Clow 
35dd1b261fSMarshall Clow     static_assert (!std::negation_v<True >, "" );
36dd1b261fSMarshall Clow     static_assert ( std::negation_v<False>, "" );
37dd1b261fSMarshall Clow 
38dd1b261fSMarshall Clow     static_assert ( std::negation<std::negation<std::true_type >>::value, "" );
39dd1b261fSMarshall Clow     static_assert (!std::negation<std::negation<std::false_type>>::value, "" );
402df59c50SJF Bastien 
412df59c50SJF Bastien   return 0;
42dd1b261fSMarshall Clow }
43