From 01fd31000b33c64a1d9b68002d5e37022aebdfad Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Tue, 7 Sep 2010 20:31:18 +0000 Subject: [PATCH] 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. llvm-svn: 113270 --- libcxx/include/__config | 3 +++ libcxx/include/type_traits | 14 +++++++++++--- .../has_trivial_copy_constructor.pass.cpp | 12 +++++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/libcxx/include/__config b/libcxx/include/__config index 87213fcbdfe3..ebd71c6e4fdd 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -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 diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index cf6d091d2eff..e8dafd7e1398 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -728,11 +728,19 @@ template struct has_nothrow_default_constructor // has_trivial_copy_constructor -template struct __has_trivial_copy_constructor : public integral_constant::value || - is_reference<_Tp>::value> {}; +#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__) template struct has_trivial_copy_constructor - : public __has_trivial_copy_constructor::type> {}; + : public integral_constant {}; + +#else // __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__) + +template struct has_trivial_copy_constructor + : public integral_constant::value || + is_reference<_Tp>::value> {}; + + +#endif // __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 || defined(__clang__) // has_nothrow_copy_constructor diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp index c51b77267289..57566504f7c3 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp @@ -37,6 +37,7 @@ class Empty class NotEmpty { +public: virtual ~NotEmpty(); }; @@ -49,6 +50,7 @@ struct bit_zero class Abstract { +public: virtual ~Abstract() = 0; }; @@ -61,17 +63,17 @@ int main() { test_has_not_trivial_copy_constructor(); test_has_not_trivial_copy_constructor(); - test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + test_has_trivial_copy_constructor(); test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); test_has_trivial_copy_constructor(); test_has_trivial_copy_constructor(); test_has_trivial_copy_constructor(); test_has_trivial_copy_constructor(); test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); test_has_trivial_copy_constructor(); }