[cfe-commits] [libcxx] r113205 - in /libcxx/trunk: include/type_traits test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp
Howard Hinnant
hhinnant at apple.com
Tue Sep 7 08:53:26 PDT 2010
Author: hhinnant
Date: Tue Sep 7 10:53:26 2010
New Revision: 113205
URL: http://llvm.org/viewvc/llvm-project?rev=113205&view=rev
Log:
has_trivial_default_constructor hooked up to clang. Filed http://llvm.org/bugs/show_bug.cgi?id=8097 to take care of void and arrays of incomplete types 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_trivial_default_constructor.pass.cpp
Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=113205&r1=113204&r2=113205&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Sep 7 10:53:26 2010
@@ -114,7 +114,6 @@
template <class T, class U> struct is_same;
template <class Base, class Derived> struct is_base_of;
template <class From, class To> struct is_convertible;
- template <class T> struct underlying_type;
// Alignment properties and transformations:
template <class T> struct alignment_of;
@@ -698,11 +697,21 @@
// has_trivial_default_constructor
-template <class _Tp> struct __has_trivial_default_constructor : public integral_constant<bool, is_scalar<_Tp>::value> {};
+#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
+
+template <class _Tp> struct has_trivial_default_constructor
+ : public integral_constant<bool, __has_trivial_constructor(_Tp)> {};
+
+#else // __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
+
+template <class _Tp> struct __has_trivial_default_constructor
+ : public integral_constant<bool, is_scalar<_Tp>::value> {};
template <class _Tp> struct has_trivial_default_constructor
: public __has_trivial_default_constructor<typename remove_all_extents<_Tp>::type> {};
+#endif // __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__)
+
// has_nothrow_default_constructor
template <class _Tp> struct has_nothrow_default_constructor : public has_trivial_default_constructor<_Tp> {};
@@ -1493,6 +1502,11 @@
#endif // _LIBCPP_HAS_NO_VARIADICS
+struct __any
+{
+ __any(...);
+};
+
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
// template <class T, class... Args> struct is_constructible;
@@ -1503,11 +1517,6 @@
decltype(_STD::move(_Tp(_STD::declval<_Args>()...)), true_type())
__is_constructible_test(_Tp&&, _Args&& ...);
-struct __any
-{
- __any(...);
-};
-
template <class ..._Args>
false_type
__is_constructible_test(__any, _Args&& ...);
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp?rev=113205&r1=113204&r2=113205&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp Tue Sep 7 10:53:26 2010
@@ -62,16 +62,16 @@
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<Abstract>();
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<char[3]>();
- test_has_trivial_default_constructor<NotEmpty>();
test_has_trivial_default_constructor<bit_zero>();
}
More information about the cfe-commits
mailing list