Fix PR#20834 - 'is_trivially_destructible yeilds wrong answer for arrays of unknown bound' Thanks to K-ballo for the bug report. Update a few of the other tests while we're here, and fix a typo in a test name.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@216909 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow 2014-09-02 16:19:38 +00:00
parent b26c966174
commit e33e03e558
14 changed files with 21 additions and 22 deletions

View File

@ -2861,7 +2861,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable
#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403) #if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
: public integral_constant<bool, __has_trivial_destructor(_Tp)> {}; : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
#else #else

View File

@ -69,7 +69,7 @@ int main()
test_has_not_virtual_destructor<int*>(); test_has_not_virtual_destructor<int*>();
test_has_not_virtual_destructor<const int*>(); test_has_not_virtual_destructor<const int*>();
test_has_not_virtual_destructor<char[3]>(); test_has_not_virtual_destructor<char[3]>();
test_has_not_virtual_destructor<char[3]>(); test_has_not_virtual_destructor<char[]>();
test_has_not_virtual_destructor<bit_zero>(); test_has_not_virtual_destructor<bit_zero>();
test_has_virtual_destructor<Abstract>(); test_has_virtual_destructor<Abstract>();

View File

@ -61,7 +61,7 @@ int main()
test_is_not_abstract<int*>(); test_is_not_abstract<int*>();
test_is_not_abstract<const int*>(); test_is_not_abstract<const int*>();
test_is_not_abstract<char[3]>(); test_is_not_abstract<char[3]>();
test_is_not_abstract<char[3]>(); test_is_not_abstract<char[]>();
test_is_not_abstract<Union>(); test_is_not_abstract<Union>();
test_is_not_abstract<Empty>(); test_is_not_abstract<Empty>();
test_is_not_abstract<bit_zero>(); test_is_not_abstract<bit_zero>();

View File

@ -30,7 +30,7 @@ int main()
test_is_const<int*>(); test_is_const<int*>();
test_is_const<const int*>(); test_is_const<const int*>();
test_is_const<char[3]>(); test_is_const<char[3]>();
test_is_const<char[3]>(); test_is_const<char[]>();
static_assert(!std::is_const<int&>::value, ""); static_assert(!std::is_const<int&>::value, "");
static_assert(!std::is_const<const int&>::value, ""); static_assert(!std::is_const<const int&>::value, "");

View File

@ -56,7 +56,7 @@ int main()
test_is_not_empty<int*>(); test_is_not_empty<int*>();
test_is_not_empty<const int*>(); test_is_not_empty<const int*>();
test_is_not_empty<char[3]>(); test_is_not_empty<char[3]>();
test_is_not_empty<char[3]>(); test_is_not_empty<char[]>();
test_is_not_empty<Union>(); test_is_not_empty<Union>();
test_is_not_empty<NotEmpty>(); test_is_not_empty<NotEmpty>();

View File

@ -60,7 +60,6 @@ int main()
test_is_not_move_assignable<const int> (); test_is_not_move_assignable<const int> ();
test_is_not_move_assignable<int[]> (); test_is_not_move_assignable<int[]> ();
test_is_not_move_assignable<int[3]> (); test_is_not_move_assignable<int[3]> ();
test_is_not_move_assignable<int[3]> ();
#endif #endif
test_is_not_move_assignable<void> (); test_is_not_move_assignable<void> ();
} }

View File

@ -23,7 +23,7 @@ void test_is_nothrow_destructible()
} }
template <class T> template <class T>
void test_has_not_nothrow_destructor() void test_is_not_nothrow_destructible()
{ {
static_assert(!std::is_nothrow_destructible<T>::value, ""); static_assert(!std::is_nothrow_destructible<T>::value, "");
static_assert(!std::is_nothrow_destructible<const T>::value, ""); static_assert(!std::is_nothrow_destructible<const T>::value, "");
@ -64,9 +64,10 @@ struct A
int main() int main()
{ {
test_has_not_nothrow_destructor<void>(); test_is_not_nothrow_destructible<void>();
test_has_not_nothrow_destructor<AbstractDestructor>(); test_is_not_nothrow_destructible<AbstractDestructor>();
test_has_not_nothrow_destructor<NotEmpty>(); test_is_not_nothrow_destructible<NotEmpty>();
test_is_not_nothrow_destructible<char[]>();
#if __has_feature(cxx_noexcept) #if __has_feature(cxx_noexcept)
test_is_nothrow_destructible<A>(); test_is_nothrow_destructible<A>();
@ -83,7 +84,6 @@ int main()
test_is_nothrow_destructible<int*>(); test_is_nothrow_destructible<int*>();
test_is_nothrow_destructible<const int*>(); test_is_nothrow_destructible<const int*>();
test_is_nothrow_destructible<char[3]>(); test_is_nothrow_destructible<char[3]>();
test_is_nothrow_destructible<char[3]>();
test_is_nothrow_destructible<Abstract>(); test_is_nothrow_destructible<Abstract>();
#if __has_feature(cxx_noexcept) #if __has_feature(cxx_noexcept)
test_is_nothrow_destructible<bit_zero>(); test_is_nothrow_destructible<bit_zero>();

View File

@ -48,5 +48,5 @@ int main()
test_is_pod<int*>(); test_is_pod<int*>();
test_is_pod<const int*>(); test_is_pod<const int*>();
test_is_pod<char[3]>(); test_is_pod<char[3]>();
test_is_pod<char[3]>(); test_is_pod<char[]>();
} }

View File

@ -69,7 +69,7 @@ int main()
test_is_not_polymorphic<int*>(); test_is_not_polymorphic<int*>();
test_is_not_polymorphic<const int*>(); test_is_not_polymorphic<const int*>();
test_is_not_polymorphic<char[3]>(); test_is_not_polymorphic<char[3]>();
test_is_not_polymorphic<char[3]>(); test_is_not_polymorphic<char[]>();
test_is_not_polymorphic<Union>(); test_is_not_polymorphic<Union>();
test_is_not_polymorphic<Empty>(); test_is_not_polymorphic<Empty>();
test_is_not_polymorphic<bit_zero>(); test_is_not_polymorphic<bit_zero>();

View File

@ -45,7 +45,7 @@ int main()
test_is_not_signed<int*>(); test_is_not_signed<int*>();
test_is_not_signed<const int*>(); test_is_not_signed<const int*>();
test_is_not_signed<char[3]>(); test_is_not_signed<char[3]>();
test_is_not_signed<char[3]>(); test_is_not_signed<char[]>();
test_is_not_signed<bool>(); test_is_not_signed<bool>();
test_is_not_signed<unsigned>(); test_is_not_signed<unsigned>();

View File

@ -23,7 +23,7 @@ void test_is_trivially_destructible()
} }
template <class T> template <class T>
void test_has_not_trivial_destructor() void test_is_not_trivially_destructible()
{ {
static_assert(!std::is_trivially_destructible<T>::value, ""); static_assert(!std::is_trivially_destructible<T>::value, "");
static_assert(!std::is_trivially_destructible<const T>::value, ""); static_assert(!std::is_trivially_destructible<const T>::value, "");
@ -64,10 +64,11 @@ struct A
int main() int main()
{ {
test_has_not_trivial_destructor<void>(); test_is_not_trivially_destructible<void>();
test_has_not_trivial_destructor<A>(); test_is_not_trivially_destructible<A>();
test_has_not_trivial_destructor<AbstractDestructor>(); test_is_not_trivially_destructible<AbstractDestructor>();
test_has_not_trivial_destructor<NotEmpty>(); test_is_not_trivially_destructible<NotEmpty>();
test_is_not_trivially_destructible<char[]>();
test_is_trivially_destructible<Abstract>(); test_is_trivially_destructible<Abstract>();
test_is_trivially_destructible<int&>(); test_is_trivially_destructible<int&>();
@ -78,6 +79,5 @@ int main()
test_is_trivially_destructible<int*>(); test_is_trivially_destructible<int*>();
test_is_trivially_destructible<const int*>(); test_is_trivially_destructible<const int*>();
test_is_trivially_destructible<char[3]>(); test_is_trivially_destructible<char[3]>();
test_is_trivially_destructible<char[3]>();
test_is_trivially_destructible<bit_zero>(); test_is_trivially_destructible<bit_zero>();
} }

View File

@ -45,7 +45,7 @@ int main()
test_is_not_unsigned<int*>(); test_is_not_unsigned<int*>();
test_is_not_unsigned<const int*>(); test_is_not_unsigned<const int*>();
test_is_not_unsigned<char[3]>(); test_is_not_unsigned<char[3]>();
test_is_not_unsigned<char[3]>(); test_is_not_unsigned<char[]>();
test_is_not_unsigned<int>(); test_is_not_unsigned<int>();
test_is_not_unsigned<double>(); test_is_not_unsigned<double>();

View File

@ -30,7 +30,7 @@ int main()
test_is_volatile<int*>(); test_is_volatile<int*>();
test_is_volatile<const int*>(); test_is_volatile<const int*>();
test_is_volatile<char[3]>(); test_is_volatile<char[3]>();
test_is_volatile<char[3]>(); test_is_volatile<char[]>();
static_assert(!std::is_volatile<int&>::value, ""); static_assert(!std::is_volatile<int&>::value, "");
static_assert(!std::is_volatile<volatile int&>::value, ""); static_assert(!std::is_volatile<volatile int&>::value, "");