| 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 |
// type_traits |
| 10 |
|
| 11 |
// bool_constant |
| 12 |
|
| 13 |
#include <type_traits> |
| 14 |
#include <cassert> |
| 15 |
|
| 16 |
#include "test_macros.h" |
| 17 |
|
| 18 |
int main(int, char**) |
| 19 |
{ |
| 20 |
#if TEST_STD_VER > 14 |
| 21 |
typedef std::bool_constant<true> _t; |
| 22 |
static_assert(_t::value, ""); |
| 23 |
static_assert((std::is_same<_t::value_type, bool>::value), ""); |
| 24 |
static_assert((std::is_same<_t::type, _t>::value), ""); |
| 25 |
static_assert((_t() == true), ""); |
| 26 |
|
| 27 |
typedef std::bool_constant<false> _f; |
| 28 |
static_assert(!_f::value, ""); |
| 29 |
static_assert((std::is_same<_f::value_type, bool>::value), ""); |
| 30 |
static_assert((std::is_same<_f::type, _f>::value), ""); |
| 31 |
static_assert((_f() == false), ""); |
| 32 |
#endif |
| 33 |
|
| 34 |
return 0; |
| 35 |
} |