Walter pointed out some missing includes in the tests. Fixing the includes uncovered a couple bugs in the _v type traits. Fixed those, too

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252612 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow 2015-11-10 15:48:23 +00:00
parent a28344c08b
commit 55d741c32e
60 changed files with 94 additions and 35 deletions

View File

@ -3211,8 +3211,8 @@ struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&,
#endif // _LIBCPP_HAS_NO_VARIADICS
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
= is_trivially_constructible<_Tp>::value;
template <class _Tp, class... _Args> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
= is_trivially_constructible<_Tp, _Args...>::value;
#endif
// is_trivially_default_constructible
@ -3629,6 +3629,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable
: public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
= is_nothrow_copy_assignable<_Tp>::value;
#endif
// is_nothrow_move_assignable
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
@ -3641,8 +3646,8 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
{};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
= is_nothrow_copy_assignable<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
= is_nothrow_move_assignable<_Tp>::value;
#endif
// is_nothrow_destructible

View File

@ -12,12 +12,14 @@
// aligned_storage
#include <type_traits>
#include <cstddef> // for std::max_align_t
#include "test_macros.h"
int main()
{
{
typedef std::aligned_storage<10, 1 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 1>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 1, "");
@ -25,7 +27,7 @@ int main()
}
{
typedef std::aligned_storage<10, 2 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 2>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@ -33,7 +35,7 @@ int main()
}
{
typedef std::aligned_storage<10, 4 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 4>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@ -41,7 +43,7 @@ int main()
}
{
typedef std::aligned_storage<10, 8 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 8>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@ -49,7 +51,7 @@ int main()
}
{
typedef std::aligned_storage<10, 16 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 16>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 16, "");
@ -57,7 +59,7 @@ int main()
}
{
typedef std::aligned_storage<10, 32 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 32>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 32, "");
@ -65,7 +67,7 @@ int main()
}
{
typedef std::aligned_storage<20, 32 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<20, 32>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 32, "");
@ -73,7 +75,7 @@ int main()
}
{
typedef std::aligned_storage<40, 32 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<40, 32>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 32, "");
@ -81,7 +83,7 @@ int main()
}
{
typedef std::aligned_storage<12, 16 >::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<12, 16>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 16, "");
@ -89,7 +91,7 @@ int main()
}
{
typedef std::aligned_storage<1>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<1>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 1, "");
@ -97,7 +99,7 @@ int main()
}
{
typedef std::aligned_storage<2>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<2>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@ -105,7 +107,7 @@ int main()
}
{
typedef std::aligned_storage<3>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<3>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@ -113,7 +115,7 @@ int main()
}
{
typedef std::aligned_storage<4>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<4>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@ -121,7 +123,7 @@ int main()
}
{
typedef std::aligned_storage<5>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<5>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@ -129,7 +131,7 @@ int main()
}
{
typedef std::aligned_storage<7>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<7>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@ -137,7 +139,7 @@ int main()
}
{
typedef std::aligned_storage<8>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<8>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@ -145,7 +147,7 @@ int main()
}
{
typedef std::aligned_storage<9>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<9>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@ -153,7 +155,7 @@ int main()
}
{
typedef std::aligned_storage<15>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<15>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@ -167,7 +169,7 @@ int main()
#endif
{
typedef std::aligned_storage<16>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<16>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
@ -176,7 +178,7 @@ int main()
}
{
typedef std::aligned_storage<17>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<17>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
@ -185,7 +187,7 @@ int main()
}
{
typedef std::aligned_storage<10>::type T1;
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");

View File

@ -12,6 +12,7 @@
// is_array
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_class
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_enum
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_floating_point
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_function
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_integral
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -14,6 +14,7 @@
// UNSUPPORTED: c++98, c++03
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_member_object_pointer
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_member_pointer
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -14,6 +14,7 @@
// UNSUPPORTED: c++98, c++03, c++11
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_pointer
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -14,6 +14,7 @@
// UNSUPPORTED: c++98, c++03
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_union
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_void
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -13,6 +13,7 @@
// is_null_pointer
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#if _LIBCPP_STD_VER > 11
template <class T>

View File

@ -12,6 +12,7 @@
// is_arithmetic
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_compound
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_fundamental
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_member_pointer
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_object
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_reference
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_scalar
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_assignable
#include <type_traits>
#include "test_macros.h"
struct A
{

View File

@ -12,6 +12,7 @@
// is_const
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_const()
@ -21,7 +22,7 @@ void test_is_const()
static_assert(!std::is_const<volatile T>::value, "");
static_assert( std::is_const<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_const_v<T>::value, "");
static_assert(!std::is_const_v<T>, "");
static_assert( std::is_const_v<const T>, "");
static_assert(!std::is_const_v<volatile T>, "");
static_assert( std::is_const_v<const volatile T>, "");

View File

@ -13,6 +13,7 @@
// struct is_constructible;
#include <type_traits>
#include "test_macros.h"
struct A
{

View File

@ -12,6 +12,7 @@
// is_copy_assignable
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_copy_assignable()

View File

@ -12,6 +12,7 @@
// is_copy_constructible
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_copy_constructible()

View File

@ -12,6 +12,7 @@
// is_default_constructible
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_default_constructible()

View File

@ -12,7 +12,6 @@
// is_destructible
#include <type_traits>
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_empty
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_empty()

View File

@ -12,6 +12,7 @@
// is_final
#include <type_traits>
#include "test_macros.h"
#if _LIBCPP_STD_VER > 11

View File

@ -12,6 +12,7 @@
// is_literal_type
#include <type_traits>
#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>
@ -79,7 +80,7 @@ int main()
// In C++14, cv-void is is a literal type
#if TEST_STD_VER < 14
test_is_not_literal_type<void>();
#elif TEST_STD_VER > 14
#else
test_is_literal_type<void>();
#endif

View File

@ -12,6 +12,7 @@
// is_move_assignable
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_move_assignable()

View File

@ -12,6 +12,7 @@
// is_move_constructible
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_move_constructible()

View File

@ -12,6 +12,7 @@
// is_nothrow_assignable
#include <type_traits>
#include "test_macros.h"
template <class T, class U>
void test_is_nothrow_assignable()

View File

@ -13,6 +13,7 @@
// struct is_nothrow_constructible;
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_nothrow_constructible()

View File

@ -12,6 +12,7 @@
// is_nothrow_copy_assignable
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_has_nothrow_assign()

View File

@ -12,6 +12,7 @@
// is_nothrow_copy_constructible
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_nothrow_copy_constructible()

View File

@ -12,6 +12,7 @@
// is_nothrow_default_constructible
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_nothrow_default_constructible()

View File

@ -12,7 +12,6 @@
// is_nothrow_destructible
#include <type_traits>
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// has_nothrow_move_assign
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_has_nothrow_assign()
@ -27,7 +28,7 @@ void test_has_not_nothrow_assign()
{
static_assert(!std::is_nothrow_move_assignable<T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_nothrow_move_assignable_v<T>, "");
static_assert(!std::is_nothrow_move_assignable_v<T>, "");
#endif
}

View File

@ -12,6 +12,7 @@
// has_nothrow_move_constructor
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_nothrow_move_constructible()

View File

@ -12,6 +12,7 @@
// is_pod
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_pod()
@ -36,10 +37,10 @@ void test_is_not_pod()
static_assert(!std::is_pod<volatile T>::value, "");
static_assert(!std::is_pod<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_pod_v<T>, "");
static_assert( std::is_pod_v<const T>, "");
static_assert( std::is_pod_v<volatile T>, "");
static_assert( std::is_pod_v<const volatile T>, "");
static_assert(!std::is_pod_v<T>, "");
static_assert(!std::is_pod_v<const T>, "");
static_assert(!std::is_pod_v<volatile T>, "");
static_assert(!std::is_pod_v<const volatile T>, "");
#endif
}

View File

@ -12,6 +12,7 @@
// is_polymorphic
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_polymorphic()

View File

@ -12,6 +12,7 @@
// is_signed
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_signed()

View File

@ -12,6 +12,7 @@
// is_standard_layout
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_standard_layout()

View File

@ -12,6 +12,7 @@
// is_trivial
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_trivial()

View File

@ -12,6 +12,7 @@
// is_trivially_assignable
#include <type_traits>
#include "test_macros.h"
template <class T, class U>
void test_is_trivially_assignable()

View File

@ -13,6 +13,7 @@
// struct is_trivially_constructible;
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_trivially_constructible()

View File

@ -12,6 +12,7 @@
// is_trivially_copy_assignable
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_has_trivially_copy_assignable()

View File

@ -12,6 +12,7 @@
// is_trivially_copy_constructible
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_trivially_copy_constructible()

View File

@ -13,6 +13,7 @@
#include <type_traits>
#include <cassert>
#include "test_macros.h"
template <class T>
void test_is_trivially_copyable()

View File

@ -12,6 +12,7 @@
// is_trivially_default_constructible
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_trivially_default_constructible()

View File

@ -12,7 +12,6 @@
// is_trivially_destructible
#include <type_traits>
#include "test_macros.h"
template <class T>

View File

@ -12,6 +12,7 @@
// is_trivially_move_assignable
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_has_trivial_assign()

View File

@ -12,6 +12,7 @@
// is_trivially_move_constructible
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_trivially_move_constructible()

View File

@ -12,6 +12,7 @@
// is_unsigned
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_unsigned()

View File

@ -12,6 +12,7 @@
// is_volatile
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_volatile()