From 331b3dd2ad1bb8ec9d2c6d6d676db988e7a95cdc Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Tue, 7 Sep 2010 23:38:59 +0000 Subject: [PATCH] has_trivial_copy_assign hooked up to clang (without workarounds). Filed http://llvm.org/bugs/show_bug.cgi?id=8109 to take care of several types which don't work yet. If there is some reason we don't want to handle these types in the compiler, I can handle most of them in the library. llvm-svn: 113312 --- libcxx/include/type_traits | 12 ++--- .../has_trivial_copy_assign.pass.cpp | 45 +++++++------------ 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index 0f45f489dab4..2aedd6041769 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -769,20 +769,14 @@ template struct has_copy_assign; #if defined(__clang__) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) -template ::value> -struct __has_trivial_copy_assign - : public integral_constant {}; - -template struct __has_trivial_copy_assign<_Tp, true> - : public false_type {}; - template struct has_trivial_copy_assign - : __has_trivial_copy_assign<_Tp> {}; + : public integral_constant {}; #else template struct has_trivial_copy_assign - : public integral_constant::value && !is_const<_Tp>::value> {}; + : public integral_constant::value && + !is_const<_Tp>::value> {}; #endif // defined(__clang__) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp index 9993cbdcdc0f..061277a1cc45 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp @@ -13,22 +13,10 @@ #include -template +template void test_has_trivial_assign() { - static_assert( std::has_trivial_copy_assign::value, ""); - static_assert(!std::has_trivial_copy_assign::value, ""); - static_assert( std::has_trivial_copy_assign::value, ""); - static_assert(!std::has_trivial_copy_assign::value, ""); -} - -template -void test_has_not_trivial_assign() -{ - static_assert(!std::has_trivial_copy_assign::value, ""); - static_assert(!std::has_trivial_copy_assign::value, ""); - static_assert(!std::has_trivial_copy_assign::value, ""); - static_assert(!std::has_trivial_copy_assign::value, ""); + static_assert(std::has_trivial_copy_assign::value == Result, ""); } class Empty @@ -59,19 +47,20 @@ struct A int main() { - test_has_not_trivial_assign(); - test_has_not_trivial_assign(); - test_has_not_trivial_assign(); - test_has_not_trivial_assign(); - test_has_not_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); }