| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// UNSUPPORTED: c++03, c++11, c++14 |
| 10 |
// type_traits |
| 11 |
|
| 12 |
// template<class B> struct negation; // C++17 |
| 13 |
// template<class B> |
| 14 |
// constexpr bool negation_v = negation<B>::value; // C++17 |
| 15 |
|
| 16 |
#include <type_traits> |
| 17 |
#include <cassert> |
| 18 |
|
| 19 |
#include "test_macros.h" |
| 20 |
|
| 21 |
struct True { static constexpr bool value = true; }; |
| 22 |
struct False { static constexpr bool value = false; }; |
| 23 |
|
| 24 |
int main(int, char**) |
| 25 |
{ |
| 26 |
static_assert (!std::negation<std::true_type >::value, "" ); |
| 27 |
static_assert ( std::negation<std::false_type>::value, "" ); |
| 28 |
|
| 29 |
static_assert (!std::negation_v<std::true_type >, "" ); |
| 30 |
static_assert ( std::negation_v<std::false_type>, "" ); |
| 31 |
|
| 32 |
static_assert (!std::negation<True >::value, "" ); |
| 33 |
static_assert ( std::negation<False>::value, "" ); |
| 34 |
|
| 35 |
static_assert (!std::negation_v<True >, "" ); |
| 36 |
static_assert ( std::negation_v<False>, "" ); |
| 37 |
|
| 38 |
static_assert ( std::negation<std::negation<std::true_type >>::value, "" ); |
| 39 |
static_assert (!std::negation<std::negation<std::false_type>>::value, "" ); |
| 40 |
|
| 41 |
return 0; |
| 42 |
} |