brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 917f8b9 Raw
36 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// type_traits10 11// bool_constant12 13#include <type_traits>14#include <cassert>15 16#include "test_macros.h"17 18int main(int, char**)19{20#if TEST_STD_VER > 1421    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#endif33 34  return 0;35}36