[cfe-commits] [libcxx] r113364 - /libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp

Howard Hinnant hhinnant at apple.com
Wed Sep 8 09:39:18 PDT 2010


Author: hhinnant
Date: Wed Sep  8 11:39:18 2010
New Revision: 113364

URL: http://llvm.org/viewvc/llvm-project?rev=113364&view=rev
Log:
has_nothrow_copy_assign hooked up to clang

Modified:
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp

Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp?rev=113364&r1=113363&r2=113364&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp Wed Sep  8 11:39:18 2010
@@ -13,29 +13,17 @@
 
 #include <type_traits>
 
-template <class T>
+template <class T, bool Result>
 void test_has_nothrow_assign()
 {
-    static_assert( std::has_nothrow_copy_assign<T>::value, "");
-    static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
-    static_assert( std::has_nothrow_copy_assign<volatile T>::value, "");
-    static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
-}
-
-template <class T>
-void test_has_not_nothrow_assign()
-{
-    static_assert(!std::has_nothrow_copy_assign<T>::value, "");
-    static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
-    static_assert(!std::has_nothrow_copy_assign<volatile T>::value, "");
-    static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
+    static_assert(std::has_nothrow_copy_assign<T>::value == Result, "");
 }
 
 class Empty
 {
 };
 
-class NotEmpty
+struct NotEmpty
 {
     virtual ~NotEmpty();
 };
@@ -47,7 +35,7 @@
     int :  0;
 };
 
-class Abstract
+struct Abstract
 {
     virtual ~Abstract() = 0;
 };
@@ -59,19 +47,19 @@
 
 int main()
 {
-    test_has_not_nothrow_assign<void>();
-    test_has_not_nothrow_assign<A>();
-    test_has_not_nothrow_assign<int&>();
-
-    test_has_nothrow_assign<Union>();
-    test_has_nothrow_assign<Abstract>();
-    test_has_nothrow_assign<Empty>();
-    test_has_nothrow_assign<int>();
-    test_has_nothrow_assign<double>();
-    test_has_nothrow_assign<int*>();
-    test_has_nothrow_assign<const int*>();
-    test_has_nothrow_assign<char[3]>();
-    test_has_nothrow_assign<char[3]>();
-    test_has_nothrow_assign<NotEmpty>();
-    test_has_nothrow_assign<bit_zero>();
+    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<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>();
 }





More information about the cfe-commits mailing list