blob: 96af4b676181e006cfff04fc7f398b66d3a2b52b [file] [log] [blame]
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <experimental/type_traits>
#include <experimental/type_traits>
#if _LIBCPP_STD_VER > 11
namespace ex = std::experimental;
struct base_type {};
struct derived_type : base_type {};
int main()
{
{
typedef int T;
typedef int U;
static_assert(ex::is_same_v<T, U>, "");
static_assert(std::is_same<decltype(ex::is_same_v<T, U>), const bool>::value, "");
static_assert(ex::is_same_v<T, U> == std::is_same<T, U>::value, "");
}
{
typedef int T;
typedef long U;
static_assert(!ex::is_same_v<T, U>, "");
static_assert(ex::is_same_v<T, U> == std::is_same<T, U>::value, "");
}
{
typedef base_type T;
typedef derived_type U;
static_assert(ex::is_base_of_v<T, U>, "");
static_assert(std::is_same<decltype(ex::is_base_of_v<T, U>), const bool>::value, "");
static_assert(ex::is_base_of_v<T, U> == std::is_base_of<T, U>::value, "");
}
{
typedef int T;
typedef int U;
static_assert(!ex::is_base_of_v<T, U>, "");
static_assert(ex::is_base_of_v<T, U> == std::is_base_of<T, U>::value, "");
}
{
typedef int T;
typedef long U;
static_assert(ex::is_convertible_v<T, U>, "");
static_assert(std::is_same<decltype(ex::is_convertible_v<T, U>), const bool>::value, "");
static_assert(ex::is_convertible_v<T, U> == std::is_convertible<T, U>::value, "");
}
{
typedef void T;
typedef int U;
static_assert(!ex::is_convertible_v<T, U>, "");
static_assert(ex::is_convertible_v<T, U> == std::is_convertible<T, U>::value, "");
}
}
#else /* _LIBCPP_STD_VER <= 11 */
int main() {}
#endif /* _LIBCPP_STD_VER > 11 */