summaryrefslogtreecommitdiffstats
path: root/libcxx/test/utilities/meta/meta.unary
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/utilities/meta/meta.unary')
-rw-r--r--libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_constructor.pass.cpp50
-rw-r--r--libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp8
2 files changed, 53 insertions, 5 deletions
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
index 7acb69509fe..f3364c1cf1f 100644
--- 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
@@ -13,7 +13,55 @@
#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()
{
-#error has_copy_constructor not implemented
+ 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_nothrow_copy_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp
index f2ebadd4e12..8dbd3e8eebf 100644
--- 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
@@ -61,11 +61,11 @@ struct A
int main()
{
-// test_has_not_nothrow_copy_constructor<void>();
+ 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_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>();
@@ -74,6 +74,6 @@ int main()
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<NotEmpty>();
test_has_nothrow_copy_constructor<bit_zero>();
}
OpenPOWER on IntegriCloud