diff options
Diffstat (limited to 'test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp')
-rw-r--r-- | test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp new file mode 100644 index 000000000000..96af4b676181 --- /dev/null +++ b/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// 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 */ |