diff options
Diffstat (limited to 'test/std/experimental/utilities/meta')
9 files changed, 0 insertions, 1091 deletions
diff --git a/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp deleted file mode 100644 index cb8db1febd27..000000000000 --- a/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// <experimental/type_traits> - -// template<class... B> struct conjunction; // C++17 -// template<class... B> -// constexpr bool conjunction_v = conjunction<B...>::value; // C++17 - -#include <experimental/type_traits> -#include <cassert> - -namespace ex = std::experimental; - -struct True { static constexpr bool value = true; }; -struct False { static constexpr bool value = false; }; - -int main() -{ - static_assert ( ex::conjunction<>::value, "" ); - static_assert ( ex::conjunction<std::true_type >::value, "" ); - static_assert (!ex::conjunction<std::false_type>::value, "" ); - - static_assert ( ex::conjunction_v<>, "" ); - static_assert ( ex::conjunction_v<std::true_type >, "" ); - static_assert (!ex::conjunction_v<std::false_type>, "" ); - - static_assert ( ex::conjunction<std::true_type, std::true_type >::value, "" ); - static_assert (!ex::conjunction<std::true_type, std::false_type>::value, "" ); - static_assert (!ex::conjunction<std::false_type, std::true_type >::value, "" ); - static_assert (!ex::conjunction<std::false_type, std::false_type>::value, "" ); - - static_assert ( ex::conjunction_v<std::true_type, std::true_type >, "" ); - static_assert (!ex::conjunction_v<std::true_type, std::false_type>, "" ); - static_assert (!ex::conjunction_v<std::false_type, std::true_type >, "" ); - static_assert (!ex::conjunction_v<std::false_type, std::false_type>, "" ); - - static_assert ( ex::conjunction<std::true_type, std::true_type, std::true_type >::value, "" ); - static_assert (!ex::conjunction<std::true_type, std::false_type, std::true_type >::value, "" ); - static_assert (!ex::conjunction<std::false_type, std::true_type, std::true_type >::value, "" ); - static_assert (!ex::conjunction<std::false_type, std::false_type, std::true_type >::value, "" ); - static_assert (!ex::conjunction<std::true_type, std::true_type, std::false_type>::value, "" ); - static_assert (!ex::conjunction<std::true_type, std::false_type, std::false_type>::value, "" ); - static_assert (!ex::conjunction<std::false_type, std::true_type, std::false_type>::value, "" ); - static_assert (!ex::conjunction<std::false_type, std::false_type, std::false_type>::value, "" ); - - static_assert ( ex::conjunction_v<std::true_type, std::true_type, std::true_type >, "" ); - static_assert (!ex::conjunction_v<std::true_type, std::false_type, std::true_type >, "" ); - static_assert (!ex::conjunction_v<std::false_type, std::true_type, std::true_type >, "" ); - static_assert (!ex::conjunction_v<std::false_type, std::false_type, std::true_type >, "" ); - static_assert (!ex::conjunction_v<std::true_type, std::true_type, std::false_type>, "" ); - static_assert (!ex::conjunction_v<std::true_type, std::false_type, std::false_type>, "" ); - static_assert (!ex::conjunction_v<std::false_type, std::true_type, std::false_type>, "" ); - static_assert (!ex::conjunction_v<std::false_type, std::false_type, std::false_type>, "" ); - - static_assert ( ex::conjunction<True >::value, "" ); - static_assert (!ex::conjunction<False>::value, "" ); - - static_assert ( ex::conjunction_v<True >, "" ); - static_assert (!ex::conjunction_v<False>, "" ); -} diff --git a/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp deleted file mode 100644 index dcdbf09fb099..000000000000 --- a/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// <experimental/type_traits> - -// template<class... B> struct disjunction; -// template<class... B> -// constexpr bool disjunction_v = disjunction<B...>::value; - -#include <experimental/type_traits> -#include <cassert> - -namespace ex = std::experimental; - -struct True { static constexpr bool value = true; }; -struct False { static constexpr bool value = false; }; - -int main() -{ - static_assert (!ex::disjunction<>::value, "" ); - static_assert ( ex::disjunction<std::true_type >::value, "" ); - static_assert (!ex::disjunction<std::false_type>::value, "" ); - - static_assert (!ex::disjunction_v<>, "" ); - static_assert ( ex::disjunction_v<std::true_type >, "" ); - static_assert (!ex::disjunction_v<std::false_type>, "" ); - - static_assert ( ex::disjunction<std::true_type, std::true_type >::value, "" ); - static_assert ( ex::disjunction<std::true_type, std::false_type>::value, "" ); - static_assert ( ex::disjunction<std::false_type, std::true_type >::value, "" ); - static_assert (!ex::disjunction<std::false_type, std::false_type>::value, "" ); - - static_assert ( ex::disjunction_v<std::true_type, std::true_type >, "" ); - static_assert ( ex::disjunction_v<std::true_type, std::false_type>, "" ); - static_assert ( ex::disjunction_v<std::false_type, std::true_type >, "" ); - static_assert (!ex::disjunction_v<std::false_type, std::false_type>, "" ); - - static_assert ( ex::disjunction<std::true_type, std::true_type, std::true_type >::value, "" ); - static_assert ( ex::disjunction<std::true_type, std::false_type, std::true_type >::value, "" ); - static_assert ( ex::disjunction<std::false_type, std::true_type, std::true_type >::value, "" ); - static_assert ( ex::disjunction<std::false_type, std::false_type, std::true_type >::value, "" ); - static_assert ( ex::disjunction<std::true_type, std::true_type, std::false_type>::value, "" ); - static_assert ( ex::disjunction<std::true_type, std::false_type, std::false_type>::value, "" ); - static_assert ( ex::disjunction<std::false_type, std::true_type, std::false_type>::value, "" ); - static_assert (!ex::disjunction<std::false_type, std::false_type, std::false_type>::value, "" ); - - static_assert ( ex::disjunction_v<std::true_type, std::true_type, std::true_type >, "" ); - static_assert ( ex::disjunction_v<std::true_type, std::false_type, std::true_type >, "" ); - static_assert ( ex::disjunction_v<std::false_type, std::true_type, std::true_type >, "" ); - static_assert ( ex::disjunction_v<std::false_type, std::false_type, std::true_type >, "" ); - static_assert ( ex::disjunction_v<std::true_type, std::true_type, std::false_type>, "" ); - static_assert ( ex::disjunction_v<std::true_type, std::false_type, std::false_type>, "" ); - static_assert ( ex::disjunction_v<std::false_type, std::true_type, std::false_type>, "" ); - static_assert (!ex::disjunction_v<std::false_type, std::false_type, std::false_type>, "" ); - - static_assert ( ex::disjunction<True >::value, "" ); - static_assert (!ex::disjunction<False>::value, "" ); - - static_assert ( ex::disjunction_v<True >, "" ); - static_assert (!ex::disjunction_v<False>, "" ); -} diff --git a/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp deleted file mode 100644 index b0d43d7e5122..000000000000 --- a/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// <experimental/type_traits> - -// template<class B> struct negation; -// template<class B> -// constexpr bool negation_v = negation<B>::value; - -#include <experimental/type_traits> -#include <cassert> - -namespace ex = std::experimental; - -struct True { static constexpr bool value = true; }; -struct False { static constexpr bool value = false; }; - -int main() -{ - static_assert (!ex::negation<std::true_type >::value, "" ); - static_assert ( ex::negation<std::false_type>::value, "" ); - - static_assert (!ex::negation_v<std::true_type >, "" ); - static_assert ( ex::negation_v<std::false_type>, "" ); - - static_assert (!ex::negation<True >::value, "" ); - static_assert ( ex::negation<False>::value, "" ); - - static_assert (!ex::negation_v<True >, "" ); - static_assert ( ex::negation_v<False>, "" ); - - static_assert ( ex::negation<ex::negation<std::true_type >>::value, "" ); - static_assert (!ex::negation<ex::negation<std::false_type>>::value, "" ); -} diff --git a/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp deleted file mode 100644 index ddc82cb5482f..000000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// <experimental/type_traits> - -#include <experimental/type_traits> - -#ifndef _LIBCPP_TYPE_TRAITS -# error "<experimental/type_traits> must include <type_traits>" -#endif - -int main() -{ -} 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 deleted file mode 100644 index 8edc917303ac..000000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// <experimental/type_traits> - -#include <experimental/type_traits> - -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, ""); - } -} - diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp deleted file mode 100644 index a4a91c136927..000000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp +++ /dev/null @@ -1,178 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// <experimental/type_traits> - -#include <experimental/type_traits> - -namespace ex = std::experimental; - -struct class_type {}; -enum enum_type {}; -union union_type {}; - -int main() -{ - { - typedef void T; - static_assert(ex::is_void_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_void_v<T>), const bool>::value, ""); - static_assert(ex::is_void_v<T> == std::is_void<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_void_v<T>, ""); - static_assert(ex::is_void_v<T> == std::is_void<T>::value, ""); - } - { - typedef decltype(nullptr) T; - static_assert(ex::is_null_pointer_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_null_pointer_v<T>), const bool>::value, ""); - static_assert(ex::is_null_pointer_v<T> == std::is_null_pointer<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_null_pointer_v<T>, ""); - static_assert(ex::is_null_pointer_v<T> == std::is_null_pointer<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_integral_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_integral_v<T>), const bool>::value, ""); - static_assert(ex::is_integral_v<T> == std::is_integral<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_integral_v<T>, ""); - static_assert(ex::is_integral_v<T> == std::is_integral<T>::value, ""); - } - { - typedef float T; - static_assert(ex::is_floating_point_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_floating_point_v<T>), const bool>::value, ""); - static_assert(ex::is_floating_point_v<T> == std::is_floating_point<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_floating_point_v<T>, ""); - static_assert(ex::is_floating_point_v<T> == std::is_floating_point<T>::value, ""); - } - { - typedef int(T)[42]; - static_assert(ex::is_array_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_array_v<T>), const bool>::value, ""); - static_assert(ex::is_array_v<T> == std::is_array<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_array_v<T>, ""); - static_assert(ex::is_array_v<T> == std::is_array<T>::value, ""); - } - { - typedef void* T; - static_assert(ex::is_pointer_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_pointer_v<T>), const bool>::value, ""); - static_assert(ex::is_pointer_v<T> == std::is_pointer<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_pointer_v<T>, ""); - static_assert(ex::is_pointer_v<T> == std::is_pointer<T>::value, ""); - } - { - typedef int & T; - static_assert(ex::is_lvalue_reference_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_lvalue_reference_v<T>), const bool>::value, ""); - static_assert(ex::is_lvalue_reference_v<T> == std::is_lvalue_reference<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_lvalue_reference_v<T>, ""); - static_assert(ex::is_lvalue_reference_v<T> == std::is_lvalue_reference<T>::value, ""); - } - { - typedef int && T; - static_assert(ex::is_rvalue_reference_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_rvalue_reference_v<T>), const bool>::value, ""); - static_assert(ex::is_rvalue_reference_v<T> == std::is_rvalue_reference<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_rvalue_reference_v<T>, ""); - static_assert(ex::is_rvalue_reference_v<T> == std::is_rvalue_reference<T>::value, ""); - } - { - typedef int class_type::*T; - static_assert(ex::is_member_object_pointer_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_member_object_pointer_v<T>), const bool>::value, ""); - static_assert(ex::is_member_object_pointer_v<T> == std::is_member_object_pointer<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_member_object_pointer_v<T>, ""); - static_assert(ex::is_member_object_pointer_v<T> == std::is_member_object_pointer<T>::value, ""); - } - { - typedef void(class_type::*T)(); - static_assert(ex::is_member_function_pointer_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_member_function_pointer_v<T>), const bool>::value, ""); - static_assert(ex::is_member_function_pointer_v<T> == std::is_member_function_pointer<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_member_function_pointer_v<T>, ""); - static_assert(ex::is_member_function_pointer_v<T> == std::is_member_function_pointer<T>::value, ""); - } - { - typedef enum_type T; - static_assert(ex::is_enum_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_enum_v<T>), const bool>::value, ""); - static_assert(ex::is_enum_v<T> == std::is_enum<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_enum_v<T>, ""); - static_assert(ex::is_enum_v<T> == std::is_enum<T>::value, ""); - } - { - typedef union_type T; - static_assert(ex::is_union_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_union_v<T>), const bool>::value, ""); - static_assert(ex::is_union_v<T> == std::is_union<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_union_v<T>, ""); - static_assert(ex::is_union_v<T> == std::is_union<T>::value, ""); - } - { - typedef class_type T; - static_assert(ex::is_class_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_class_v<T>), const bool>::value, ""); - static_assert(ex::is_class_v<T> == std::is_class<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_class_v<T>, ""); - static_assert(ex::is_class_v<T> == std::is_class<T>::value, ""); - } - { - typedef void(T)(); - static_assert(ex::is_function_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_function_v<T>), const bool>::value, ""); - static_assert(ex::is_function_v<T> == std::is_function<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_function_v<T>, ""); - static_assert(ex::is_function_v<T> == std::is_function<T>::value, ""); - } -} - diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp deleted file mode 100644 index b3927b120951..000000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp +++ /dev/null @@ -1,99 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// <experimental/type_traits> - -#include <experimental/type_traits> - -namespace ex = std::experimental; - -struct class_type {}; - -int main() -{ - { - typedef int & T; - static_assert(ex::is_reference_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_reference_v<T>), const bool>::value, ""); - static_assert(ex::is_reference_v<T> == std::is_reference<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_reference_v<T>, ""); - static_assert(ex::is_reference_v<T> == std::is_reference<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_arithmetic_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_arithmetic_v<T>), const bool>::value, ""); - static_assert(ex::is_arithmetic_v<T> == std::is_arithmetic<T>::value, ""); - } - { - typedef void* T; - static_assert(!ex::is_arithmetic_v<T>, ""); - static_assert(ex::is_arithmetic_v<T> == std::is_arithmetic<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_fundamental_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_fundamental_v<T>), const bool>::value, ""); - static_assert(ex::is_fundamental_v<T> == std::is_fundamental<T>::value, ""); - } - { - typedef class_type T; - static_assert(!ex::is_fundamental_v<T>, ""); - static_assert(ex::is_fundamental_v<T> == std::is_fundamental<T>::value, ""); - } - { - typedef class_type T; - static_assert(ex::is_object_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_object_v<T>), const bool>::value, ""); - static_assert(ex::is_object_v<T> == std::is_object<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_object_v<T>, ""); - static_assert(ex::is_object_v<T> == std::is_object<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_scalar_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_scalar_v<T>), const bool>::value, ""); - static_assert(ex::is_scalar_v<T> == std::is_scalar<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_scalar_v<T>, ""); - static_assert(ex::is_scalar_v<T> == std::is_scalar<T>::value, ""); - } - { - typedef void* T; - static_assert(ex::is_compound_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_compound_v<T>), const bool>::value, ""); - static_assert(ex::is_compound_v<T> == std::is_compound<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_compound_v<T>, ""); - static_assert(ex::is_compound_v<T> == std::is_compound<T>::value, ""); - } - { - typedef int class_type::*T; - static_assert(ex::is_member_pointer_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_member_pointer_v<T>), const bool>::value, ""); - static_assert(ex::is_member_pointer_v<T> == std::is_member_pointer<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_member_pointer_v<T>, ""); - static_assert(ex::is_member_pointer_v<T> == std::is_member_pointer<T>::value, ""); - } -} - diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp deleted file mode 100644 index bfd385a1b8e3..000000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp +++ /dev/null @@ -1,492 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// GCC returns true for __is_trivially_constructible(void, int) -// See gcc.gnu.org/PR80682 -// NOTE: This has been fixed in trunk and will be backported soon. -// XFAIL: gcc-7, gcc-6, gcc-5, gcc-4 - -// <experimental/type_traits> - -#include <experimental/type_traits> - -namespace ex = std::experimental; - -struct non_literal_type { non_literal_type() {} }; -struct empty_type {}; - -struct polymorphic_type -{ - virtual void foo() {} -}; - -struct abstract_type -{ - virtual void foo() = 0; -}; - -struct final_type final {}; - -struct virtual_dtor_type -{ - virtual ~virtual_dtor_type() {} -}; - -void type_properties_test() -{ - { - typedef const int T; - static_assert(ex::is_const_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_const_v<T>), const bool>::value, ""); - static_assert(ex::is_const_v<T> == std::is_const<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_const_v<T>, ""); - static_assert(ex::is_const_v<T> == std::is_const<T>::value, ""); - } - { - typedef volatile int T; - static_assert(ex::is_volatile_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_volatile_v<T>), const bool>::value, ""); - static_assert(ex::is_volatile_v<T> == std::is_volatile<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_volatile_v<T>, ""); - static_assert(ex::is_volatile_v<T> == std::is_volatile<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivial_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_trivial_v<T>), const bool>::value, ""); - static_assert(ex::is_trivial_v<T> == std::is_trivial<T>::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_trivial_v<T>, ""); - static_assert(ex::is_trivial_v<T> == std::is_trivial<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_copyable_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_copyable_v<T>), const bool>::value, ""); - static_assert(ex::is_trivially_copyable_v<T> == std::is_trivially_copyable<T>::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_trivially_copyable_v<T>, ""); - static_assert(ex::is_trivially_copyable_v<T> == std::is_trivially_copyable<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_standard_layout_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_standard_layout_v<T>), const bool>::value, ""); - static_assert(ex::is_standard_layout_v<T> == std::is_standard_layout<T>::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_standard_layout_v<T>, ""); - static_assert(ex::is_standard_layout_v<T> == std::is_standard_layout<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_pod_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_pod_v<T>), const bool>::value, ""); - static_assert(ex::is_pod_v<T> == std::is_pod<T>::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_pod_v<T>, ""); - static_assert(ex::is_pod_v<T> == std::is_pod<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_literal_type_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_literal_type_v<T>), const bool>::value, ""); - static_assert(ex::is_literal_type_v<T> == std::is_literal_type<T>::value, ""); - } - { - typedef non_literal_type T; - static_assert(!ex::is_literal_type_v<T>, ""); - static_assert(ex::is_literal_type_v<T> == std::is_literal_type<T>::value, ""); - } - { - typedef empty_type T; - static_assert(ex::is_empty_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_empty_v<T>), const bool>::value, ""); - static_assert(ex::is_empty_v<T> == std::is_empty<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_empty_v<T>, ""); - static_assert(ex::is_empty_v<T> == std::is_empty<T>::value, ""); - } - { - typedef polymorphic_type T; - static_assert(ex::is_polymorphic_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_polymorphic_v<T>), const bool>::value, ""); - static_assert(ex::is_polymorphic_v<T> == std::is_polymorphic<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_polymorphic_v<T>, ""); - static_assert(ex::is_polymorphic_v<T> == std::is_polymorphic<T>::value, ""); - } - { - typedef abstract_type T; - static_assert(ex::is_abstract_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_abstract_v<T>), const bool>::value, ""); - static_assert(ex::is_abstract_v<T> == std::is_abstract<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_abstract_v<T>, ""); - static_assert(ex::is_abstract_v<T> == std::is_abstract<T>::value, ""); - } - { - typedef final_type T; - static_assert(ex::is_final_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_final_v<T>), const bool>::value, ""); - static_assert(ex::is_final_v<T> == std::is_final<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_final_v<T>, ""); - static_assert(ex::is_final_v<T> == std::is_final<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_signed_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_signed_v<T>), const bool>::value, ""); - static_assert(ex::is_signed_v<T> == std::is_signed<T>::value, ""); - } - { - typedef unsigned T; - static_assert(!ex::is_signed_v<T>, ""); - static_assert(ex::is_signed_v<T> == std::is_signed<T>::value, ""); - } - { - typedef unsigned T; - static_assert(ex::is_unsigned_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_unsigned_v<T>), const bool>::value, ""); - static_assert(ex::is_unsigned_v<T> == std::is_unsigned<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::is_unsigned_v<T>, ""); - static_assert(ex::is_unsigned_v<T> == std::is_unsigned<T>::value, ""); - } -} - -void is_constructible_and_assignable_test() -{ - { - typedef int T; - static_assert(ex::is_constructible_v<T, int>, ""); - static_assert(std::is_same<decltype(ex::is_constructible_v<T, int>), const bool>::value, ""); - static_assert(ex::is_constructible_v<T, int> == std::is_constructible<T, int>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_constructible_v<T, int>, ""); - static_assert(ex::is_constructible_v<T, int> == std::is_constructible<T, int>::value, ""); - } - { - typedef int T; - static_assert(ex::is_default_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_default_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_default_constructible_v<T> == std::is_default_constructible<T>::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_default_constructible_v<T>, ""); - static_assert(ex::is_default_constructible_v<T> == std::is_default_constructible<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_copy_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_copy_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_copy_constructible_v<T> == std::is_copy_constructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_copy_constructible_v<T>, ""); - static_assert(ex::is_copy_constructible_v<T> == std::is_copy_constructible<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_move_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_move_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_move_constructible_v<T> == std::is_move_constructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_move_constructible_v<T>, ""); - static_assert(ex::is_move_constructible_v<T> == std::is_move_constructible<T>::value, ""); - } - { - typedef int & T; - typedef int U; - static_assert(ex::is_assignable_v<T, U>, ""); - static_assert(std::is_same<decltype(ex::is_assignable_v<T, U>), const bool>::value, ""); - static_assert(ex::is_assignable_v<T, U> == std::is_assignable<T, U>::value, ""); - } - { - typedef int & T; - typedef void U; - static_assert(!ex::is_assignable_v<T, U>, ""); - static_assert(ex::is_assignable_v<T, U> == std::is_assignable<T, U>::value, ""); - } - { - typedef int T; - static_assert(ex::is_copy_assignable_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_copy_assignable_v<T>), const bool>::value, ""); - static_assert(ex::is_copy_assignable_v<T> == std::is_copy_assignable<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_copy_assignable_v<T>, ""); - static_assert(ex::is_copy_assignable_v<T> == std::is_copy_assignable<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_move_assignable_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_move_assignable_v<T>), const bool>::value, ""); - static_assert(ex::is_move_assignable_v<T> == std::is_move_assignable<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_move_assignable_v<T>, ""); - static_assert(ex::is_move_assignable_v<T> == std::is_move_assignable<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_destructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_destructible_v<T>), const bool>::value, ""); - static_assert(ex::is_destructible_v<T> == std::is_destructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_destructible_v<T>, ""); - static_assert(ex::is_destructible_v<T> == std::is_destructible<T>::value, ""); - } -} - -void is_trivially_constructible_and_assignable_test() -{ - { - typedef int T; - static_assert(ex::is_trivially_constructible_v<T, int>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_constructible_v<T, int>), const bool>::value, ""); - static_assert(ex::is_trivially_constructible_v<T, int> == std::is_constructible<T, int>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_constructible_v<T, int>, ""); - static_assert(ex::is_trivially_constructible_v<T, int> == std::is_constructible<T, int>::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_default_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_default_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_trivially_default_constructible_v<T> == std::is_default_constructible<T>::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_trivially_default_constructible_v<T>, ""); - static_assert(ex::is_trivially_default_constructible_v<T> == std::is_default_constructible<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_copy_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_copy_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_trivially_copy_constructible_v<T> == std::is_copy_constructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_copy_constructible_v<T>, ""); - static_assert(ex::is_trivially_copy_constructible_v<T> == std::is_copy_constructible<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_move_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_move_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_trivially_move_constructible_v<T> == std::is_move_constructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_move_constructible_v<T>, ""); - static_assert(ex::is_trivially_move_constructible_v<T> == std::is_move_constructible<T>::value, ""); - } - { - typedef int & T; - typedef int U; - static_assert(ex::is_trivially_assignable_v<T, U>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_assignable_v<T, U>), const bool>::value, ""); - static_assert(ex::is_trivially_assignable_v<T, U> == std::is_assignable<T, U>::value, ""); - } - { - typedef int & T; - typedef void U; - static_assert(!ex::is_trivially_assignable_v<T, U>, ""); - static_assert(ex::is_trivially_assignable_v<T, U> == std::is_assignable<T, U>::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_copy_assignable_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_copy_assignable_v<T>), const bool>::value, ""); - static_assert(ex::is_trivially_copy_assignable_v<T> == std::is_copy_assignable<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_copy_assignable_v<T>, ""); - static_assert(ex::is_trivially_copy_assignable_v<T> == std::is_copy_assignable<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_move_assignable_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_move_assignable_v<T>), const bool>::value, ""); - static_assert(ex::is_trivially_move_assignable_v<T> == std::is_move_assignable<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_move_assignable_v<T>, ""); - static_assert(ex::is_trivially_move_assignable_v<T> == std::is_move_assignable<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_destructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_trivially_destructible_v<T>), const bool>::value, ""); - static_assert(ex::is_trivially_destructible_v<T> == std::is_destructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_destructible_v<T>, ""); - static_assert(ex::is_trivially_destructible_v<T> == std::is_destructible<T>::value, ""); - } -} - - - -void is_nothrow_constructible_and_assignable_test() -{ - { - typedef int T; - static_assert(ex::is_nothrow_constructible_v<T, int>, ""); - static_assert(std::is_same<decltype(ex::is_nothrow_constructible_v<T, int>), const bool>::value, ""); - static_assert(ex::is_nothrow_constructible_v<T, int> == std::is_constructible<T, int>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_constructible_v<T, int>, ""); - static_assert(ex::is_nothrow_constructible_v<T, int> == std::is_constructible<T, int>::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_default_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_nothrow_default_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_nothrow_default_constructible_v<T> == std::is_default_constructible<T>::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_nothrow_default_constructible_v<T>, ""); - static_assert(ex::is_nothrow_default_constructible_v<T> == std::is_default_constructible<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_copy_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_nothrow_copy_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_nothrow_copy_constructible_v<T> == std::is_copy_constructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_copy_constructible_v<T>, ""); - static_assert(ex::is_nothrow_copy_constructible_v<T> == std::is_copy_constructible<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_move_constructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_nothrow_move_constructible_v<T>), const bool>::value, ""); - static_assert(ex::is_nothrow_move_constructible_v<T> == std::is_move_constructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_move_constructible_v<T>, ""); - static_assert(ex::is_nothrow_move_constructible_v<T> == std::is_move_constructible<T>::value, ""); - } - { - typedef int & T; - typedef int U; - static_assert(ex::is_nothrow_assignable_v<T, U>, ""); - static_assert(std::is_same<decltype(ex::is_nothrow_assignable_v<T, U>), const bool>::value, ""); - static_assert(ex::is_nothrow_assignable_v<T, U> == std::is_assignable<T, U>::value, ""); - } - { - typedef int & T; - typedef void U; - static_assert(!ex::is_nothrow_assignable_v<T, U>, ""); - static_assert(ex::is_nothrow_assignable_v<T, U> == std::is_assignable<T, U>::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_copy_assignable_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_nothrow_copy_assignable_v<T>), const bool>::value, ""); - static_assert(ex::is_nothrow_copy_assignable_v<T> == std::is_copy_assignable<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_copy_assignable_v<T>, ""); - static_assert(ex::is_nothrow_copy_assignable_v<T> == std::is_copy_assignable<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_move_assignable_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_nothrow_move_assignable_v<T>), const bool>::value, ""); - static_assert(ex::is_nothrow_move_assignable_v<T> == std::is_move_assignable<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_move_assignable_v<T>, ""); - static_assert(ex::is_nothrow_move_assignable_v<T> == std::is_move_assignable<T>::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_destructible_v<T>, ""); - static_assert(std::is_same<decltype(ex::is_nothrow_destructible_v<T>), const bool>::value, ""); - static_assert(ex::is_nothrow_destructible_v<T> == std::is_destructible<T>::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_destructible_v<T>, ""); - static_assert(ex::is_nothrow_destructible_v<T> == std::is_destructible<T>::value, ""); - } -} - -int main() -{ - type_properties_test(); - is_constructible_and_assignable_test(); - is_trivially_constructible_and_assignable_test(); - is_nothrow_constructible_and_assignable_test(); - { - typedef virtual_dtor_type T; - static_assert(ex::has_virtual_destructor_v<T>, ""); - static_assert(std::is_same<decltype(ex::has_virtual_destructor_v<T>), const bool>::value, ""); - static_assert(ex::has_virtual_destructor_v<T> == std::has_virtual_destructor<T>::value, ""); - } - { - typedef int T; - static_assert(!ex::has_virtual_destructor_v<T>, ""); - static_assert(ex::has_virtual_destructor_v<T> == std::has_virtual_destructor<T>::value, ""); - } -} - diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp deleted file mode 100644 index f91667da523c..000000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// <experimental/type_traits> - -#include <experimental/type_traits> - -namespace ex = std::experimental; - -int main() -{ - { - typedef char T; - static_assert(ex::alignment_of_v<T> == 1, ""); - static_assert(std::is_same<decltype(ex::alignment_of_v<T>), const std::size_t>::value, ""); - static_assert(ex::alignment_of_v<T> == std::alignment_of<T>::value, ""); - } - { - typedef char(T)[1][1][1]; - static_assert(ex::rank_v<T> == 3, ""); - static_assert(std::is_same<decltype(ex::rank_v<T>), const std::size_t>::value, ""); - static_assert(ex::rank_v<T> == std::rank<T>::value, ""); - } - { - typedef void T; - static_assert(ex::rank_v<T> == 0, ""); - static_assert(ex::rank_v<T> == std::rank<T>::value, ""); - } - { - typedef char(T)[2][3][4]; - static_assert(ex::extent_v<T> == 2, ""); - static_assert(std::is_same<decltype(ex::extent_v<T>), const std::size_t>::value, ""); - static_assert(ex::extent_v<T> == std::extent<T>::value, ""); - } - { - typedef char(T)[2][3][4]; - static_assert(ex::extent_v<T, 0> == 2, ""); - static_assert(ex::extent_v<T, 0> == std::extent<T, 0>::value, ""); - } - { - typedef char(T)[2][3][4]; - static_assert(ex::extent_v<T, 1> == 3, ""); - static_assert(ex::extent_v<T, 1> == std::extent<T, 1>::value, ""); - } - { - typedef char(T)[2][3][4]; - static_assert(ex::extent_v<T, 5> == 0, ""); - static_assert(ex::extent_v<T, 5> == std::extent<T, 5>::value, ""); - } - { - typedef void T; - static_assert(ex::extent_v<T, 0> == 0, ""); - static_assert(ex::extent_v<T, 0> == std::extent<T, 0>::value, ""); - } -} |