diff options
author | Howard Hinnant <hhinnant@apple.com> | 2010-11-19 22:17:28 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2010-11-19 22:17:28 +0000 |
commit | ca740483988a36f54a94ecb515d23f055fddf384 (patch) | |
tree | e24bf6469057fedb0e402f6e6ad51a193561b978 /libcxx/test/utilities | |
parent | dfb8c3bbfcab611b98f6d8a532e67169bb46ece4 (diff) | |
download | bcm5719-llvm-ca740483988a36f54a94ecb515d23f055fddf384.tar.gz bcm5719-llvm-ca740483988a36f54a94ecb515d23f055fddf384.zip |
N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right.
llvm-svn: 119854
Diffstat (limited to 'libcxx/test/utilities')
38 files changed, 1235 insertions, 723 deletions
diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_assign.pass.cpp deleted file mode 100644 index c6503722278..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_assign.pass.cpp +++ /dev/null @@ -1,50 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_copy_assign - -#include <type_traits> - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -struct A -{ - A(); -}; - -int main() -{ - static_assert(( std::has_copy_assign<int>::value), ""); - static_assert((!std::has_copy_assign<const int>::value), ""); - static_assert((!std::has_copy_assign<int[]>::value), ""); - static_assert((!std::has_copy_assign<int[3]>::value), ""); - static_assert((!std::has_copy_assign<int&>::value), ""); - static_assert(( std::has_copy_assign<A>::value), ""); - static_assert(( std::has_copy_assign<bit_zero>::value), ""); - static_assert(( std::has_copy_assign<Union>::value), ""); - static_assert(( std::has_copy_assign<NotEmpty>::value), ""); - static_assert(( std::has_copy_assign<Empty>::value), ""); -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_constructor.pass.cpp deleted file mode 100644 index 8d74613494f..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_constructor.pass.cpp +++ /dev/null @@ -1,67 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_copy_constructor - -#include <type_traits> - -template <class T, bool Result> -void test_has_copy_constructor() -{ - static_assert(std::has_copy_constructor<T>::value == Result, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(const A&); -}; - -int main() -{ - test_has_copy_constructor<char[3], false>(); - test_has_copy_constructor<char[], false>(); - test_has_copy_constructor<void, false>(); - test_has_copy_constructor<Abstract, false>(); - - test_has_copy_constructor<A, true>(); - test_has_copy_constructor<int&, true>(); - test_has_copy_constructor<Union, true>(); - test_has_copy_constructor<Empty, true>(); - test_has_copy_constructor<int, true>(); - test_has_copy_constructor<double, true>(); - test_has_copy_constructor<int*, true>(); - test_has_copy_constructor<const int*, true>(); - test_has_copy_constructor<NotEmpty, true>(); - test_has_copy_constructor<bit_zero, true>(); -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_default_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_default_constructor.pass.cpp deleted file mode 100644 index 7a4c98b3929..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_default_constructor.pass.cpp +++ /dev/null @@ -1,70 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_default_constructor - -#include <type_traits> - -template <class T, bool Result> -void test_has_default_constructor() -{ - static_assert(std::has_default_constructor<T>::value == Result, ""); - static_assert(std::has_default_constructor<const T>::value == Result, ""); - static_assert(std::has_default_constructor<volatile T>::value == Result, ""); - static_assert(std::has_default_constructor<const volatile T>::value == Result, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(); -}; - -int main() -{ - test_has_default_constructor<void, false>(); - test_has_default_constructor<int&, false>(); - test_has_default_constructor<char[], false>(); - test_has_default_constructor<Abstract, false>(); - - test_has_default_constructor<A, true>(); - test_has_default_constructor<Union, true>(); - test_has_default_constructor<Empty, true>(); - test_has_default_constructor<int, true>(); - test_has_default_constructor<double, true>(); - test_has_default_constructor<int*, true>(); - test_has_default_constructor<const int*, true>(); - test_has_default_constructor<char[3], true>(); - test_has_default_constructor<NotEmpty, true>(); - test_has_default_constructor<bit_zero, true>(); -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_move_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_move_assign.pass.cpp deleted file mode 100644 index 135a0ed79f8..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_move_assign.pass.cpp +++ /dev/null @@ -1,19 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_move_assign - -#include <type_traits> - -int main() -{ -#error has_move_assign not implemented -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_move_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_move_constructor.pass.cpp deleted file mode 100644 index 0f1161e0d20..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_move_constructor.pass.cpp +++ /dev/null @@ -1,19 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_move_constructor - -#include <type_traits> - -int main() -{ -#error has_move_constructor not implemented -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp deleted file mode 100644 index 53600872565..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp +++ /dev/null @@ -1,79 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_nothrow_copy_constructor - -#include <type_traits> - -template <class T> -void test_has_nothrow_copy_constructor() -{ - static_assert( std::has_nothrow_copy_constructor<T>::value, ""); - static_assert( std::has_nothrow_copy_constructor<const T>::value, ""); - static_assert( std::has_nothrow_copy_constructor<volatile T>::value, ""); - static_assert( std::has_nothrow_copy_constructor<const volatile T>::value, ""); -} - -template <class T> -void test_has_not_nothrow_copy_constructor() -{ - static_assert(!std::has_nothrow_copy_constructor<T>::value, ""); - static_assert(!std::has_nothrow_copy_constructor<const T>::value, ""); - static_assert(!std::has_nothrow_copy_constructor<volatile T>::value, ""); - static_assert(!std::has_nothrow_copy_constructor<const volatile T>::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(const A&); -}; - -int main() -{ - test_has_not_nothrow_copy_constructor<void>(); - test_has_not_nothrow_copy_constructor<A>(); - test_has_not_nothrow_copy_constructor<Abstract>(); - test_has_not_nothrow_copy_constructor<char[3]>(); - test_has_not_nothrow_copy_constructor<char[]>(); - - test_has_nothrow_copy_constructor<int&>(); - test_has_nothrow_copy_constructor<Union>(); - test_has_nothrow_copy_constructor<Empty>(); - test_has_nothrow_copy_constructor<int>(); - test_has_nothrow_copy_constructor<double>(); - test_has_nothrow_copy_constructor<int*>(); - test_has_nothrow_copy_constructor<const int*>(); - test_has_nothrow_copy_constructor<NotEmpty>(); - test_has_nothrow_copy_constructor<bit_zero>(); -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp deleted file mode 100644 index 071578392c3..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp +++ /dev/null @@ -1,79 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_nothrow_default_constructor - -#include <type_traits> - -template <class T> -void test_has_nothrow_default_constructor() -{ - static_assert( std::has_nothrow_default_constructor<T>::value, ""); - static_assert( std::has_nothrow_default_constructor<const T>::value, ""); - static_assert( std::has_nothrow_default_constructor<volatile T>::value, ""); - static_assert( std::has_nothrow_default_constructor<const volatile T>::value, ""); -} - -template <class T> -void test_has_not_nothrow_default_constructor() -{ - static_assert(!std::has_nothrow_default_constructor<T>::value, ""); - static_assert(!std::has_nothrow_default_constructor<const T>::value, ""); - static_assert(!std::has_nothrow_default_constructor<volatile T>::value, ""); - static_assert(!std::has_nothrow_default_constructor<const volatile T>::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(); -}; - -int main() -{ - test_has_not_nothrow_default_constructor<void>(); - test_has_not_nothrow_default_constructor<int&>(); - test_has_not_nothrow_default_constructor<A>(); - test_has_not_nothrow_default_constructor<char[]>(); - test_has_not_nothrow_default_constructor<Abstract>(); - - test_has_nothrow_default_constructor<Union>(); - test_has_nothrow_default_constructor<Empty>(); - test_has_nothrow_default_constructor<int>(); - test_has_nothrow_default_constructor<double>(); - test_has_nothrow_default_constructor<int*>(); - test_has_nothrow_default_constructor<const int*>(); - test_has_nothrow_default_constructor<char[3]>(); - test_has_nothrow_default_constructor<NotEmpty>(); - test_has_nothrow_default_constructor<bit_zero>(); -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_assign.pass.cpp deleted file mode 100644 index bee6a0646ed..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_assign.pass.cpp +++ /dev/null @@ -1,19 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_nothrow_move_assign - -#include <type_traits> - -int main() -{ -#error has_nothrow_move_assign not implemented -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_constructor.pass.cpp deleted file mode 100644 index 949256ac2f0..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_constructor.pass.cpp +++ /dev/null @@ -1,19 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_nothrow_move_constructor - -#include <type_traits> - -int main() -{ -#error has_nothrow_move_constructor not implemented -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp deleted file mode 100644 index 684466114a2..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp +++ /dev/null @@ -1,79 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_copy_constructor - -#include <type_traits> - -template <class T> -void test_has_trivial_copy_constructor() -{ - static_assert( std::has_trivial_copy_constructor<T>::value, ""); - static_assert( std::has_trivial_copy_constructor<const T>::value, ""); - static_assert( std::has_trivial_copy_constructor<volatile T>::value, ""); - static_assert( std::has_trivial_copy_constructor<const volatile T>::value, ""); -} - -template <class T> -void test_has_not_trivial_copy_constructor() -{ - static_assert(!std::has_trivial_copy_constructor<T>::value, ""); - static_assert(!std::has_trivial_copy_constructor<const T>::value, ""); - static_assert(!std::has_trivial_copy_constructor<volatile T>::value, ""); - static_assert(!std::has_trivial_copy_constructor<const volatile T>::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(const A&); -}; - -int main() -{ - test_has_not_trivial_copy_constructor<void>(); - test_has_not_trivial_copy_constructor<A>(); - test_has_not_trivial_copy_constructor<char[3]>(); - test_has_not_trivial_copy_constructor<char[]>(); - test_has_not_trivial_copy_constructor<Abstract>(); - test_has_not_trivial_copy_constructor<NotEmpty>(); - - test_has_trivial_copy_constructor<int&>(); - test_has_trivial_copy_constructor<Union>(); - test_has_trivial_copy_constructor<Empty>(); - test_has_trivial_copy_constructor<int>(); - test_has_trivial_copy_constructor<double>(); - test_has_trivial_copy_constructor<int*>(); - test_has_trivial_copy_constructor<const int*>(); - test_has_trivial_copy_constructor<bit_zero>(); -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp deleted file mode 100644 index 7dda08e8453..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp +++ /dev/null @@ -1,77 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_default_constructor - -#include <type_traits> - -template <class T> -void test_has_trivial_default_constructor() -{ - static_assert( std::has_trivial_default_constructor<T>::value, ""); - static_assert( std::has_trivial_default_constructor<const T>::value, ""); - static_assert( std::has_trivial_default_constructor<volatile T>::value, ""); - static_assert( std::has_trivial_default_constructor<const volatile T>::value, ""); -} - -template <class T> -void test_has_not_trivial_default_constructor() -{ - static_assert(!std::has_trivial_default_constructor<T>::value, ""); - static_assert(!std::has_trivial_default_constructor<const T>::value, ""); - static_assert(!std::has_trivial_default_constructor<volatile T>::value, ""); - static_assert(!std::has_trivial_default_constructor<const volatile T>::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ - virtual ~Abstract() = 0; -}; - -struct A -{ - A(); -}; - -int main() -{ - test_has_not_trivial_default_constructor<void>(); - test_has_not_trivial_default_constructor<int&>(); - test_has_not_trivial_default_constructor<A>(); - test_has_not_trivial_default_constructor<Abstract>(); - test_has_not_trivial_default_constructor<NotEmpty>(); - test_has_not_trivial_default_constructor<char[]>(); - - test_has_trivial_default_constructor<Union>(); - test_has_trivial_default_constructor<Empty>(); - test_has_trivial_default_constructor<int>(); - test_has_trivial_default_constructor<double>(); - test_has_trivial_default_constructor<int*>(); - test_has_trivial_default_constructor<const int*>(); - test_has_trivial_default_constructor<char[3]>(); - test_has_trivial_default_constructor<bit_zero>(); -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp deleted file mode 100644 index cbfc416755e..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp +++ /dev/null @@ -1,77 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_destructor - -#include <type_traits> - -template <class T> -void test_has_trivial_destructor() -{ - static_assert( std::has_trivial_destructor<T>::value, ""); - static_assert( std::has_trivial_destructor<const T>::value, ""); - static_assert( std::has_trivial_destructor<volatile T>::value, ""); - static_assert( std::has_trivial_destructor<const volatile T>::value, ""); -} - -template <class T> -void test_has_not_trivial_destructor() -{ - static_assert(!std::has_trivial_destructor<T>::value, ""); - static_assert(!std::has_trivial_destructor<const T>::value, ""); - static_assert(!std::has_trivial_destructor<volatile T>::value, ""); - static_assert(!std::has_trivial_destructor<const volatile T>::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ - virtual ~Abstract() = 0; -}; - -struct A -{ - ~A(); -}; - -int main() -{ - test_has_not_trivial_destructor<void>(); - test_has_not_trivial_destructor<A>(); - test_has_not_trivial_destructor<Abstract>(); - test_has_not_trivial_destructor<NotEmpty>(); - - test_has_trivial_destructor<int&>(); - test_has_trivial_destructor<Union>(); - test_has_trivial_destructor<Empty>(); - test_has_trivial_destructor<int>(); - test_has_trivial_destructor<double>(); - test_has_trivial_destructor<int*>(); - test_has_trivial_destructor<const int*>(); - test_has_trivial_destructor<char[3]>(); - test_has_trivial_destructor<char[3]>(); - test_has_trivial_destructor<bit_zero>(); -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_assign.pass.cpp deleted file mode 100644 index 268c1a698de..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_assign.pass.cpp +++ /dev/null @@ -1,19 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_move_assign - -#include <type_traits> - -int main() -{ -#error has_trivial_move_assign not implemented -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_constructor.pass.cpp deleted file mode 100644 index 5a47b14f8d2..00000000000 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_constructor.pass.cpp +++ /dev/null @@ -1,19 +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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_move_constructor - -#include <type_traits> - -int main() -{ -#error has_trivial_move_constructor not implemented -} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp new file mode 100644 index 00000000000..d836e6ac73a --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_assignable + +#include <type_traits> + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +int main() +{ + static_assert(( std::is_assignable<int&, int&>::value), ""); + static_assert(( std::is_assignable<int&, int>::value), ""); + static_assert((!std::is_assignable<int, int&>::value), ""); + static_assert((!std::is_assignable<int, int>::value), ""); + static_assert(( std::is_assignable<int&, double>::value), ""); + static_assert(( std::is_assignable<B, A>::value), ""); + static_assert((!std::is_assignable<A, B>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp index 00b247b222d..40b15c4eaed 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -14,25 +14,17 @@ #include <type_traits> -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE - struct A { explicit A(int); A(int, double); }; -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE - int main() { -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE - static_assert((std::is_constructible<int>::value), ""); static_assert((std::is_constructible<int, const int>::value), ""); static_assert((std::is_constructible<A, int>::value), ""); static_assert((std::is_constructible<A, int, double>::value), ""); static_assert((!std::is_constructible<A>::value), ""); - -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE } diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp new file mode 100644 index 00000000000..c44ba6d04d6 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_copy_assignable + +#include <type_traits> + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + static_assert(( std::is_copy_assignable<int>::value), ""); + static_assert((!std::is_copy_assignable<const int>::value), ""); + static_assert((!std::is_copy_assignable<int[]>::value), ""); + static_assert((!std::is_copy_assignable<int[3]>::value), ""); + static_assert(( std::is_copy_assignable<int&>::value), ""); + static_assert(( std::is_copy_assignable<A>::value), ""); + static_assert(( std::is_copy_assignable<bit_zero>::value), ""); + static_assert(( std::is_copy_assignable<Union>::value), ""); + static_assert(( std::is_copy_assignable<NotEmpty>::value), ""); + static_assert(( std::is_copy_assignable<Empty>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp new file mode 100644 index 00000000000..691ac69301e --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp @@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_copy_constructible + +#include <type_traits> + +template <class T, bool Result> +void test_is_copy_constructible() +{ + static_assert(std::is_copy_constructible<T>::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_is_copy_constructible<char[3], false>(); + test_is_copy_constructible<char[], false>(); + test_is_copy_constructible<void, false>(); + test_is_copy_constructible<Abstract, false>(); + + test_is_copy_constructible<A, true>(); + test_is_copy_constructible<int&, true>(); + test_is_copy_constructible<Union, true>(); + test_is_copy_constructible<Empty, true>(); + test_is_copy_constructible<int, true>(); + test_is_copy_constructible<double, true>(); + test_is_copy_constructible<int*, true>(); + test_is_copy_constructible<const int*, true>(); + test_is_copy_constructible<NotEmpty, true>(); + test_is_copy_constructible<bit_zero, true>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp new file mode 100644 index 00000000000..0830ce166d1 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_default_constructible + +#include <type_traits> + +template <class T, bool Result> +void test_is_default_constructible() +{ + static_assert(std::is_default_constructible<T>::value == Result, ""); + static_assert(std::is_default_constructible<const T>::value == Result, ""); + static_assert(std::is_default_constructible<volatile T>::value == Result, ""); + static_assert(std::is_default_constructible<const volatile T>::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_is_default_constructible<void, false>(); + test_is_default_constructible<int&, false>(); + test_is_default_constructible<char[], false>(); + test_is_default_constructible<Abstract, false>(); + + test_is_default_constructible<A, true>(); + test_is_default_constructible<Union, true>(); + test_is_default_constructible<Empty, true>(); + test_is_default_constructible<int, true>(); + test_is_default_constructible<double, true>(); + test_is_default_constructible<int*, true>(); + test_is_default_constructible<const int*, true>(); + test_is_default_constructible<char[3], true>(); + test_is_default_constructible<NotEmpty, true>(); + test_is_default_constructible<bit_zero, true>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp new file mode 100644 index 00000000000..61b04b2ab4a --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_destructible + +#include <type_traits> + +template <class T, bool Result> +void test_is_destructible() +{ + static_assert( std::is_destructible<T>::value == Result, ""); + static_assert( std::is_destructible<const T>::value == Result, ""); + static_assert( std::is_destructible<volatile T>::value == Result, ""); + static_assert( std::is_destructible<const volatile T>::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_is_destructible<void, false>(); + test_is_destructible<A, true>(); + test_is_destructible<Abstract, false>(); + test_is_destructible<NotEmpty, false>(); + test_is_destructible<int&, true>(); + test_is_destructible<Union, true>(); + test_is_destructible<Empty, true>(); + test_is_destructible<int, true>(); + test_is_destructible<double, true>(); + test_is_destructible<int*, true>(); + test_is_destructible<const int*, true>(); + test_is_destructible<char[3], true>(); + test_is_destructible<bit_zero, true>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp new file mode 100644 index 00000000000..3f44f8ebcb9 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_move_assignable + +#include <type_traits> + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + static_assert(( std::is_move_assignable<int>::value), ""); + static_assert((!std::is_move_assignable<const int>::value), ""); + static_assert((!std::is_move_assignable<int[]>::value), ""); + static_assert((!std::is_move_assignable<int[3]>::value), ""); + static_assert(( std::is_move_assignable<int&>::value), ""); + static_assert(( std::is_move_assignable<A>::value), ""); + static_assert(( std::is_move_assignable<bit_zero>::value), ""); + static_assert(( std::is_move_assignable<Union>::value), ""); + static_assert(( std::is_move_assignable<NotEmpty>::value), ""); + static_assert(( std::is_move_assignable<Empty>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp new file mode 100644 index 00000000000..3ad3666a222 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp @@ -0,0 +1,73 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_move_constructible + +#include <type_traits> + +template <class T, bool Result> +void test_is_move_constructible() +{ + static_assert(std::is_move_constructible<T>::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +struct B +{ + B(B&&); +}; + +int main() +{ + test_is_move_constructible<char[3], false>(); + test_is_move_constructible<char[], false>(); + test_is_move_constructible<void, false>(); + test_is_move_constructible<Abstract, false>(); + + test_is_move_constructible<A, true>(); + test_is_move_constructible<int&, true>(); + test_is_move_constructible<Union, true>(); + test_is_move_constructible<Empty, true>(); + test_is_move_constructible<int, true>(); + test_is_move_constructible<double, true>(); + test_is_move_constructible<int*, true>(); + test_is_move_constructible<const int*, true>(); + test_is_move_constructible<NotEmpty, true>(); + test_is_move_constructible<bit_zero, true>(); + test_is_move_constructible<B, true>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp new file mode 100644 index 00000000000..b57115269c2 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_assignable + +#include <type_traits> + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +int main() +{ + static_assert(( std::is_nothrow_assignable<int&, int&>::value), ""); + static_assert(( std::is_nothrow_assignable<int&, int>::value), ""); + static_assert((!std::is_nothrow_assignable<int, int&>::value), ""); + static_assert((!std::is_nothrow_assignable<int, int>::value), ""); + static_assert(( std::is_nothrow_assignable<int&, double>::value), ""); + static_assert((!std::is_nothrow_assignable<B, A>::value), ""); + static_assert((!std::is_nothrow_assignable<A, B>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp index 24c9eceaabb..3dc73cef1eb 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp @@ -14,8 +14,6 @@ #include <type_traits> -#ifndef _LIBCPP_HAS_NO_VARIADICS - class Empty { }; @@ -42,11 +40,11 @@ struct A A(const A&); }; -#endif // _LIBCPP_HAS_NO_VARIADICS - int main() { -#ifndef _LIBCPP_HAS_NO_VARIADICS - static_assert((std::is_nothrow_constructible<int, const int>::value), ""); -#endif + static_assert(( std::is_nothrow_constructible<int>::value), ""); + static_assert(( std::is_nothrow_constructible<int, const int&>::value), ""); + static_assert((!std::is_nothrow_constructible<A, int>::value), ""); + static_assert((!std::is_nothrow_constructible<A, int, double>::value), ""); + static_assert((!std::is_nothrow_constructible<A>::value), ""); } diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp index f9947b887b4..b0fe0638559 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp @@ -9,14 +9,14 @@ // type_traits -// has_nothrow_copy_assign +// is_nothrow_copy_assignable #include <type_traits> template <class T, bool Result> void test_has_nothrow_assign() { - static_assert(std::has_nothrow_copy_assign<T>::value == Result, ""); + static_assert(std::is_nothrow_copy_assignable<T>::value == Result, ""); } class Empty @@ -35,11 +35,6 @@ struct bit_zero int : 0; }; -struct Abstract -{ - virtual ~Abstract() = 0; -}; - struct A { A& operator=(const A&); @@ -49,10 +44,7 @@ int main() { test_has_nothrow_assign<void, false>(); test_has_nothrow_assign<A, false>(); - test_has_nothrow_assign<int&, false>(); - test_has_nothrow_assign<Abstract, false>(); - test_has_nothrow_assign<char[3], false>(); - test_has_nothrow_assign<char[], false>(); + test_has_nothrow_assign<int&, true>(); test_has_nothrow_assign<Union, true>(); test_has_nothrow_assign<Empty, true>(); diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp new file mode 100644 index 00000000000..6bb510441bc --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_copy_constructible + +#include <type_traits> + +template <class T> +void test_is_nothrow_copy_constructible() +{ + static_assert( std::is_nothrow_copy_constructible<T>::value, ""); + static_assert( std::is_nothrow_copy_constructible<const T>::value, ""); + static_assert( std::is_nothrow_copy_constructible<volatile T>::value, ""); + static_assert( std::is_nothrow_copy_constructible<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_nothrow_copy_constructor() +{ + static_assert(!std::is_nothrow_copy_constructible<T>::value, ""); + static_assert(!std::is_nothrow_copy_constructible<const T>::value, ""); + static_assert(!std::is_nothrow_copy_constructible<volatile T>::value, ""); + static_assert(!std::is_nothrow_copy_constructible<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_nothrow_copy_constructor<void>(); + test_has_not_nothrow_copy_constructor<A>(); + + test_is_nothrow_copy_constructible<int&>(); + test_is_nothrow_copy_constructible<Union>(); + test_is_nothrow_copy_constructible<Empty>(); + test_is_nothrow_copy_constructible<int>(); + test_is_nothrow_copy_constructible<double>(); + test_is_nothrow_copy_constructible<int*>(); + test_is_nothrow_copy_constructible<const int*>(); + test_is_nothrow_copy_constructible<NotEmpty>(); + test_is_nothrow_copy_constructible<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp new file mode 100644 index 00000000000..84fb5f41bf1 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp @@ -0,0 +1,71 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_default_constructible + +#include <type_traits> + +template <class T> +void test_is_nothrow_default_constructible() +{ + static_assert( std::is_nothrow_default_constructible<T>::value, ""); + static_assert( std::is_nothrow_default_constructible<const T>::value, ""); + static_assert( std::is_nothrow_default_constructible<volatile T>::value, ""); + static_assert( std::is_nothrow_default_constructible<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_nothrow_default_constructor() +{ + static_assert(!std::is_nothrow_default_constructible<T>::value, ""); + static_assert(!std::is_nothrow_default_constructible<const T>::value, ""); + static_assert(!std::is_nothrow_default_constructible<volatile T>::value, ""); + static_assert(!std::is_nothrow_default_constructible<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_has_not_nothrow_default_constructor<void>(); + test_has_not_nothrow_default_constructor<int&>(); + test_has_not_nothrow_default_constructor<A>(); + + test_is_nothrow_default_constructible<Union>(); + test_is_nothrow_default_constructible<Empty>(); + test_is_nothrow_default_constructible<int>(); + test_is_nothrow_default_constructible<double>(); + test_is_nothrow_default_constructible<int*>(); + test_is_nothrow_default_constructible<const int*>(); + test_is_nothrow_default_constructible<char[3]>(); + test_is_nothrow_default_constructible<NotEmpty>(); + test_is_nothrow_default_constructible<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp new file mode 100644 index 00000000000..dfa1b36cf21 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_destructible + +#include <type_traits> + +template <class T> +void test_is_nothrow_destructible() +{ + static_assert( std::is_nothrow_destructible<T>::value, ""); + static_assert( std::is_nothrow_destructible<const T>::value, ""); + static_assert( std::is_nothrow_destructible<volatile T>::value, ""); + static_assert( std::is_nothrow_destructible<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_nothrow_destructor() +{ + static_assert(!std::is_nothrow_destructible<T>::value, ""); + static_assert(!std::is_nothrow_destructible<const T>::value, ""); + static_assert(!std::is_nothrow_destructible<volatile T>::value, ""); + static_assert(!std::is_nothrow_destructible<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_has_not_nothrow_destructor<void>(); + test_has_not_nothrow_destructor<A>(); + test_has_not_nothrow_destructor<Abstract>(); + test_has_not_nothrow_destructor<NotEmpty>(); + + test_is_nothrow_destructible<int&>(); + test_is_nothrow_destructible<Union>(); + test_is_nothrow_destructible<Empty>(); + test_is_nothrow_destructible<int>(); + test_is_nothrow_destructible<double>(); + test_is_nothrow_destructible<int*>(); + test_is_nothrow_destructible<const int*>(); + test_is_nothrow_destructible<char[3]>(); + test_is_nothrow_destructible<char[3]>(); + test_is_nothrow_destructible<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp new file mode 100644 index 00000000000..96a4a32b37d --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_move_assign + +#include <type_traits> + +template <class T, bool Result> +void test_has_nothrow_assign() +{ + static_assert(std::is_nothrow_move_assignable<T>::value == Result, ""); +} + +class Empty +{ +}; + +struct NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_nothrow_assign<void, false>(); + test_has_nothrow_assign<A, false>(); + test_has_nothrow_assign<int&, true>(); + + test_has_nothrow_assign<Union, true>(); + test_has_nothrow_assign<Empty, true>(); + test_has_nothrow_assign<int, true>(); + test_has_nothrow_assign<double, true>(); + test_has_nothrow_assign<int*, true>(); + test_has_nothrow_assign<const int*, true>(); + test_has_nothrow_assign<NotEmpty, true>(); + test_has_nothrow_assign<bit_zero, true>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp new file mode 100644 index 00000000000..fc5207601e8 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_move_constructor + +#include <type_traits> + +template <class T> +void test_is_nothrow_move_constructible() +{ + static_assert( std::is_nothrow_move_constructible<T>::value, ""); + static_assert( std::is_nothrow_move_constructible<const T>::value, ""); + static_assert( std::is_nothrow_move_constructible<volatile T>::value, ""); + static_assert( std::is_nothrow_move_constructible<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_nothrow_move_constructor() +{ + static_assert(!std::is_nothrow_move_constructible<T>::value, ""); + static_assert(!std::is_nothrow_move_constructible<const T>::value, ""); + static_assert(!std::is_nothrow_move_constructible<volatile T>::value, ""); + static_assert(!std::is_nothrow_move_constructible<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_nothrow_move_constructor<void>(); + test_has_not_nothrow_move_constructor<A>(); + + test_has_not_nothrow_move_constructor<int&>(); + test_is_nothrow_move_constructible<Union>(); + test_is_nothrow_move_constructible<Empty>(); + test_is_nothrow_move_constructible<int>(); + test_is_nothrow_move_constructible<double>(); + test_is_nothrow_move_constructible<int*>(); + test_is_nothrow_move_constructible<const int*>(); + test_is_nothrow_move_constructible<NotEmpty>(); + test_is_nothrow_move_constructible<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp new file mode 100644 index 00000000000..cd6d5d277be --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_assignable + +#include <type_traits> + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +int main() +{ + static_assert(( std::is_trivially_assignable<int&, int&>::value), ""); + static_assert(( std::is_trivially_assignable<int&, int>::value), ""); + static_assert((!std::is_trivially_assignable<int, int&>::value), ""); + static_assert((!std::is_trivially_assignable<int, int>::value), ""); + static_assert(( std::is_trivially_assignable<int&, double>::value), ""); + static_assert((!std::is_trivially_assignable<B, A>::value), ""); + static_assert((!std::is_trivially_assignable<A, B>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp new file mode 100644 index 00000000000..ce0373baf28 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// template <class T, class... Args> +// struct is_trivially_constructible; + +#include <type_traits> + +struct A +{ + explicit A(int); + A(int, double); +}; + +int main() +{ + static_assert(( std::is_trivially_constructible<int>::value), ""); + static_assert(( std::is_trivially_constructible<int, const int&>::value), ""); + static_assert((!std::is_trivially_constructible<A, int>::value), ""); + static_assert((!std::is_trivially_constructible<A, int, double>::value), ""); + static_assert((!std::is_trivially_constructible<A>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp index aa604a9f2a8..2ec06a09e74 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp @@ -9,14 +9,14 @@ // type_traits -// has_trivial_copy_assign +// is_trivially_copy_assignable #include <type_traits> template <class T, bool Result> void test_has_trivial_assign() { - static_assert(std::has_trivial_copy_assign<T>::value == Result, ""); + static_assert(std::is_trivially_copy_assignable<T>::value == Result, ""); } class Empty @@ -49,12 +49,10 @@ int main() { test_has_trivial_assign<void, false>(); test_has_trivial_assign<A, false>(); - test_has_trivial_assign<int&, false>(); + test_has_trivial_assign<int&, true>(); test_has_trivial_assign<NotEmpty, false>(); test_has_trivial_assign<Abstract, false>(); test_has_trivial_assign<const Empty, false>(); - test_has_trivial_assign<char[3], false>(); - test_has_trivial_assign<char[], false>(); test_has_trivial_assign<Union, true>(); test_has_trivial_assign<Empty, true>(); diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp new file mode 100644 index 00000000000..45f63622f85 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_copy_constructible + +#include <type_traits> + +template <class T> +void test_is_trivially_copy_constructible() +{ + static_assert( std::is_trivially_copy_constructible<T>::value, ""); + static_assert( std::is_trivially_copy_constructible<const T>::value, ""); + static_assert( std::is_trivially_copy_constructible<volatile T>::value, ""); + static_assert( std::is_trivially_copy_constructible<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_trivial_copy_constructor() +{ + static_assert(!std::is_trivially_copy_constructible<T>::value, ""); + static_assert(!std::is_trivially_copy_constructible<const T>::value, ""); + static_assert(!std::is_trivially_copy_constructible<volatile T>::value, ""); + static_assert(!std::is_trivially_copy_constructible<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_trivial_copy_constructor<void>(); + test_has_not_trivial_copy_constructor<A>(); + test_has_not_trivial_copy_constructor<Abstract>(); + test_has_not_trivial_copy_constructor<NotEmpty>(); + + test_is_trivially_copy_constructible<int&>(); + test_is_trivially_copy_constructible<Union>(); + test_is_trivially_copy_constructible<Empty>(); + test_is_trivially_copy_constructible<int>(); + test_is_trivially_copy_constructible<double>(); + test_is_trivially_copy_constructible<int*>(); + test_is_trivially_copy_constructible<const int*>(); + test_is_trivially_copy_constructible<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp new file mode 100644 index 00000000000..1f63401dacb --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp @@ -0,0 +1,76 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_default_constructible + +#include <type_traits> + +template <class T> +void test_is_trivially_default_constructible() +{ + static_assert( std::is_trivially_default_constructible<T>::value, ""); + static_assert( std::is_trivially_default_constructible<const T>::value, ""); + static_assert( std::is_trivially_default_constructible<volatile T>::value, ""); + static_assert( std::is_trivially_default_constructible<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_trivial_default_constructor() +{ + static_assert(!std::is_trivially_default_constructible<T>::value, ""); + static_assert(!std::is_trivially_default_constructible<const T>::value, ""); + static_assert(!std::is_trivially_default_constructible<volatile T>::value, ""); + static_assert(!std::is_trivially_default_constructible<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_has_not_trivial_default_constructor<void>(); + test_has_not_trivial_default_constructor<int&>(); + test_has_not_trivial_default_constructor<A>(); + test_has_not_trivial_default_constructor<Abstract>(); + test_has_not_trivial_default_constructor<NotEmpty>(); + + test_is_trivially_default_constructible<Union>(); + test_is_trivially_default_constructible<Empty>(); + test_is_trivially_default_constructible<int>(); + test_is_trivially_default_constructible<double>(); + test_is_trivially_default_constructible<int*>(); + test_is_trivially_default_constructible<const int*>(); + test_is_trivially_default_constructible<char[3]>(); + test_is_trivially_default_constructible<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp new file mode 100644 index 00000000000..ebe10e32009 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_destructible + +#include <type_traits> + +template <class T> +void test_is_trivially_destructible() +{ + static_assert( std::is_trivially_destructible<T>::value, ""); + static_assert( std::is_trivially_destructible<const T>::value, ""); + static_assert( std::is_trivially_destructible<volatile T>::value, ""); + static_assert( std::is_trivially_destructible<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_trivial_destructor() +{ + static_assert(!std::is_trivially_destructible<T>::value, ""); + static_assert(!std::is_trivially_destructible<const T>::value, ""); + static_assert(!std::is_trivially_destructible<volatile T>::value, ""); + static_assert(!std::is_trivially_destructible<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_has_not_trivial_destructor<void>(); + test_has_not_trivial_destructor<A>(); + test_has_not_trivial_destructor<Abstract>(); + test_has_not_trivial_destructor<NotEmpty>(); + + test_is_trivially_destructible<int&>(); + test_is_trivially_destructible<Union>(); + test_is_trivially_destructible<Empty>(); + test_is_trivially_destructible<int>(); + test_is_trivially_destructible<double>(); + test_is_trivially_destructible<int*>(); + test_is_trivially_destructible<const int*>(); + test_is_trivially_destructible<char[3]>(); + test_is_trivially_destructible<char[3]>(); + test_is_trivially_destructible<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp new file mode 100644 index 00000000000..dcdaa25b16a --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_move_assignable + +#include <type_traits> + +template <class T, bool Result> +void test_has_trivial_assign() +{ + static_assert(std::is_trivially_move_assignable<T>::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_trivial_assign<void, false>(); + test_has_trivial_assign<A, false>(); + test_has_trivial_assign<int&, true>(); + test_has_trivial_assign<NotEmpty, false>(); + test_has_trivial_assign<Abstract, false>(); + test_has_trivial_assign<const Empty, false>(); + + test_has_trivial_assign<Union, true>(); + test_has_trivial_assign<Empty, true>(); + test_has_trivial_assign<int, true>(); + test_has_trivial_assign<double, true>(); + test_has_trivial_assign<int*, true>(); + test_has_trivial_assign<const int*, true>(); + test_has_trivial_assign<bit_zero, true>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp new file mode 100644 index 00000000000..a4fcbcb09c5 --- /dev/null +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_move_constructible + +#include <type_traits> + +template <class T> +void test_is_trivially_move_constructible() +{ + static_assert( std::is_trivially_move_constructible<T>::value, ""); + static_assert( std::is_trivially_move_constructible<const T>::value, ""); + static_assert( std::is_trivially_move_constructible<volatile T>::value, ""); + static_assert( std::is_trivially_move_constructible<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_trivial_move_constructor() +{ + static_assert(!std::is_trivially_move_constructible<T>::value, ""); + static_assert(!std::is_trivially_move_constructible<const T>::value, ""); + static_assert(!std::is_trivially_move_constructible<volatile T>::value, ""); + static_assert(!std::is_trivially_move_constructible<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_trivial_move_constructor<void>(); + test_has_not_trivial_move_constructor<A>(); + test_has_not_trivial_move_constructor<Abstract>(); + test_has_not_trivial_move_constructor<NotEmpty>(); + + test_is_trivially_move_constructible<int&>(); + test_is_trivially_move_constructible<Union>(); + test_is_trivially_move_constructible<Empty>(); + test_is_trivially_move_constructible<int>(); + test_is_trivially_move_constructible<double>(); + test_is_trivially_move_constructible<int*>(); + test_is_trivially_move_constructible<const int*>(); + test_is_trivially_move_constructible<bit_zero>(); +} |