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

Howard Hinnant hhinnant at apple.com
Tue Sep 7 10:15:18 PDT 2010


Author: hhinnant
Date: Tue Sep  7 12:15:17 2010
New Revision: 113217

URL: http://llvm.org/viewvc/llvm-project?rev=113217&view=rev
Log:
has_nothrow_default_constructor hooked up to clang.  Filed http://llvm.org/bugs/show_bug.cgi?id=8101 to take care of void, arrays of incomplete types, and classes with virtual destructors which don't work yet.  If there is some reasons we don't want to handle these types in the compiler, I can handle them in the library.

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

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=113217&r1=113216&r2=113217&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Sep  7 12:15:17 2010
@@ -714,7 +714,17 @@
 
 // has_nothrow_default_constructor
 
-template <class _Tp> struct has_nothrow_default_constructor : public has_trivial_default_constructor<_Tp> {};
+#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
+
+template <class _Tp> struct has_nothrow_default_constructor
+    : public integral_constant<bool, __has_nothrow_constructor(_Tp)> {};
+
+#else  // __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
+
+template <class _Tp> struct has_nothrow_default_constructor
+    : public has_trivial_default_constructor<_Tp> {};
+
+#endif  // __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
 
 // has_trivial_copy_constructor
 

Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp?rev=113217&r1=113216&r2=113217&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp Tue Sep  7 12:15:17 2010
@@ -62,16 +62,16 @@
     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<Abstract>();
     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<char[3]>();
     test_has_nothrow_default_constructor<NotEmpty>();
     test_has_nothrow_default_constructor<bit_zero>();
 }





More information about the cfe-commits mailing list