[cfe-commits] [libcxx] r113270 - in /libcxx/trunk: include/__config include/type_traits test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp

Howard Hinnant hhinnant at apple.com
Tue Sep 7 13:31:18 PDT 2010


Author: hhinnant
Date: Tue Sep  7 15:31:18 2010
New Revision: 113270

URL: http://llvm.org/viewvc/llvm-project?rev=113270&view=rev
Log:
has_trivial_copy_constructor hooked up to clang.  Filed http://llvm.org/bugs/show_bug.cgi?id=8105 to take care of void, arrays of incomplete bounds and complete bounds which don't work yet.  If there is some reason we don't want to handle these types in the compiler, I can handle them in the library.

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/type_traits
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=113270&r1=113269&r2=113270&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Tue Sep  7 15:31:18 2010
@@ -88,7 +88,10 @@
 
 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
 #define _LIBCPP_HAS_NO_UNICODE_CHARS
+#endif
 
 #if !(__has_feature(cxx_exceptions))
 #define _LIBCPP_NO_EXCEPTIONS

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=113270&r1=113269&r2=113270&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Sep  7 15:31:18 2010
@@ -728,11 +728,19 @@
 
 // has_trivial_copy_constructor
 
-template <class _Tp> struct __has_trivial_copy_constructor : public integral_constant<bool, is_scalar<_Tp>::value ||
-                                                                                is_reference<_Tp>::value> {};
+#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
 
 template <class _Tp> struct has_trivial_copy_constructor
-    : public __has_trivial_copy_constructor<typename remove_all_extents<_Tp>::type> {};
+    : public integral_constant<bool, __has_trivial_copy(_Tp)> {};
+
+#else  // __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
+
+template <class _Tp> struct has_trivial_copy_constructor
+    : public integral_constant<bool, is_scalar<_Tp>::value ||
+                                     is_reference<_Tp>::value> {};
+
+
+#endif  // __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
 
 // has_nothrow_copy_constructor
 

Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp?rev=113270&r1=113269&r2=113270&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp Tue Sep  7 15:31:18 2010
@@ -37,6 +37,7 @@
 
 class NotEmpty
 {
+public:
     virtual ~NotEmpty();
 };
 
@@ -49,6 +50,7 @@
 
 class Abstract
 {
+public:
     virtual ~Abstract() = 0;
 };
 
@@ -61,17 +63,17 @@
 {
     test_has_not_trivial_copy_constructor<void>();
     test_has_not_trivial_copy_constructor<A>();
-    test_has_not_trivial_copy_constructor<int&>();
+    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<Abstract>();
     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<char[3]>();
-    test_has_trivial_copy_constructor<char[3]>();
-    test_has_trivial_copy_constructor<NotEmpty>();
     test_has_trivial_copy_constructor<bit_zero>();
 }





More information about the cfe-commits mailing list