//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // #include "test_macros.h" TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header") #include <__cxx03/__type_traits/conjunction.h> #include <__cxx03/__type_traits/disjunction.h> #include <__cxx03/__type_traits/is_valid_expansion.h> #include <__cxx03/__type_traits/negation.h> #include #include #include struct Bomb; template struct BOOM { using Explode = typename T::BOOMBOOM; }; using True = std::true_type; using False = std::false_type; void test_if() { ASSERT_SAME_TYPE(std::_If, int); ASSERT_SAME_TYPE(std::_If, long); } void test_and() { static_assert(std::_And::value, ""); static_assert(!std::_And::value, ""); static_assert(std::_And::value, ""); static_assert(!std::_And >::value, ""); static_assert(!std::_And >::value, ""); } void test_or() { static_assert(std::_Or::value, ""); static_assert(!std::_Or::value, ""); static_assert(std::_Or::value, ""); static_assert(std::_Or > >::value, ""); static_assert(!std::_Or::value, ""); static_assert(std::_Or >::value, ""); static_assert(std::_Or >::value, ""); } void test_combined() { static_assert(std::_And > >::value, ""); static_assert(std::_And > >::value, ""); static_assert(std::_Not > >::value, ""); } struct MemberTest { static int foo; using type = long; void func(int); }; struct Empty {}; struct MemberTest2 { using foo = int; }; template using HasFooData = decltype(T::foo); template using HasFooType = typename T::foo; template using FuncCallable = decltype(std::declval().func(std::declval())); template using BadCheck = typename T::DOES_NOT_EXIST; void test_is_valid_trait() { static_assert(std::_IsValidExpansion::value, ""); static_assert(!std::_IsValidExpansion::value, ""); static_assert(!std::_IsValidExpansion::value, ""); static_assert(std::_IsValidExpansion::value, ""); static_assert(std::_IsValidExpansion::value, ""); static_assert(!std::_IsValidExpansion::value, ""); } int main(int, char**) { return 0; }