forked from OSchip/llvm-project
Reworked all the utilities/meta tests to use ASSERT_SAME_TYPE instead of 'static_assert( is_same<'. Much easier to read. I left two tests alone: is_same.pass.cpp, which should call 'is_same' directly, and common_type.pass.cpp, which Eric is working on. NFC intended
llvm-svn: 357146
This commit is contained in:
parent
a5e175c60c
commit
24fa56bcc8
|
@ -19,9 +19,9 @@ enum Enum {zero, one_};
|
|||
template <class T, class U>
|
||||
void test_remove_all_extents()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_all_extents<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::remove_all_extents<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_all_extents_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::remove_all_extents_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ enum Enum {zero, one_};
|
|||
template <class T, class U>
|
||||
void test_remove_extent()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_extent<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::remove_extent<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_extent_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::remove_extent_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
template <class T, class U>
|
||||
void test_add_const_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_const<T>::type, const U>::value), "");
|
||||
ASSERT_SAME_TYPE(const U, typename std::add_const<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_const_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(const U, std::add_const_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
template <class T, class U>
|
||||
void test_add_cv_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), "");
|
||||
ASSERT_SAME_TYPE(const volatile U, typename std::add_cv<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_cv_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(const volatile U, std::add_cv_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
template <class T, class U>
|
||||
void test_add_volatile_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_volatile<T>::type, volatile U>::value), "");
|
||||
ASSERT_SAME_TYPE(volatile U, typename std::add_volatile<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_volatile_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(volatile U, std::add_volatile_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
template <class T, class U>
|
||||
void test_remove_const_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::remove_const<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_const_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::remove_const_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
template <class T, class U>
|
||||
void test_remove_cv_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_cv<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::remove_cv<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_cv_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::remove_cv_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
template <class T, class U>
|
||||
void test_remove_volatile_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_volatile<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::remove_volatile<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_volatile_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::remove_volatile_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<10, 1 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 1>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<10, 1>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -35,7 +35,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<10, 2 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 2>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<10, 2>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -48,7 +48,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<10, 4 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 4>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<10, 4>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -61,7 +61,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<10, 8 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 8>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<10, 8>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -74,7 +74,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<10, 16 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 16>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<10, 16>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -87,7 +87,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<10, 32 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 32>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<10, 32>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -100,7 +100,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<20, 32 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<20, 32>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<20, 32>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -113,7 +113,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<40, 32 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<40, 32>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<40, 32>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -126,7 +126,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<12, 16 >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<12, 16>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<12, 16>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -139,7 +139,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<1>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<1>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<1>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -152,7 +152,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<2>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<2>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<2>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -165,7 +165,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<3>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<3>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<3>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -178,7 +178,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<4>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<4>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<4>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -191,7 +191,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<5>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<5>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<5>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -204,7 +204,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<7>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<7>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<7>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -214,7 +214,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<8>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<8>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<8>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -227,7 +227,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<9>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<9>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<9>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -240,7 +240,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<15>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<15>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<15>);
|
||||
#endif
|
||||
#if TEST_STD_VER <= 17
|
||||
static_assert(std::is_pod<T1>::value, "");
|
||||
|
@ -256,7 +256,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<16>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<16>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<16>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -267,7 +267,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<17>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<17>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<17>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -278,7 +278,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_storage<10>::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10>, T1>::value, "");
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_storage_t<10>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
|
|
@ -24,7 +24,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<10, char >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, char>, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<10, char>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -34,7 +34,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<10, short >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, short>, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<10, short>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -44,7 +44,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<10, int >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, int>, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<10, int>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -54,7 +54,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<10, double >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, double>, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<10, double>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -64,7 +64,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<10, short, char >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, short, char>, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<10, short, char>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -74,7 +74,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<10, char, short >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, char, short>, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<10, char, short>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -84,7 +84,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<2, int, char, short >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<2, int, char, short>, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<2, int, char, short>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -94,7 +94,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<2, char, int, short >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<2, char, int, short >, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<2, char, int, short>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
@ -104,7 +104,7 @@ int main(int, char**)
|
|||
{
|
||||
typedef std::aligned_union<2, char, short, int >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<2, char, short, int >, T1>::value, "" );
|
||||
ASSERT_SAME_TYPE(T1, std::aligned_union_t<2, char, short, int>);
|
||||
#endif
|
||||
static_assert(std::is_trivial<T1>::value, "");
|
||||
static_assert(std::is_standard_layout<T1>::value, "");
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
int main(int, char**)
|
||||
{
|
||||
static_assert((std::is_same<std::conditional<true, char, int>::type, char>::value), "");
|
||||
static_assert((std::is_same<std::conditional<false, char, int>::type, int>::value), "");
|
||||
ASSERT_SAME_TYPE(char, std::conditional<true, char, int>::type);
|
||||
ASSERT_SAME_TYPE(int, std::conditional<false, char, int>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::conditional_t<true, char, int>, char>::value), "");
|
||||
static_assert((std::is_same<std::conditional_t<false, char, int>, int>::value), "");
|
||||
ASSERT_SAME_TYPE(char, std::conditional_t<true, char, int>);
|
||||
ASSERT_SAME_TYPE(int, std::conditional_t<false, char, int>);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
template <class T, class U>
|
||||
void test_decay()
|
||||
{
|
||||
static_assert((std::is_same<typename std::decay<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::decay<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::decay_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::decay_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
int main(int, char**)
|
||||
{
|
||||
static_assert((std::is_same<std::enable_if<true>::type, void>::value), "");
|
||||
static_assert((std::is_same<std::enable_if<true, int>::type, int>::value), "");
|
||||
ASSERT_SAME_TYPE(void, std::enable_if<true>::type);
|
||||
ASSERT_SAME_TYPE(int, std::enable_if<true, int>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::enable_if_t<true>, void>::value), "");
|
||||
static_assert((std::is_same<std::enable_if_t<true, int>, int>::value), "");
|
||||
ASSERT_SAME_TYPE(void, std::enable_if_t<true, void>);
|
||||
ASSERT_SAME_TYPE(int, std::enable_if_t<true, int>);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
template <class T, class U>
|
||||
void test_remove_cvref()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_cvref<T>::type, U>::value), "");
|
||||
static_assert((std::is_same< std::remove_cvref_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::remove_cvref<T>::type);
|
||||
ASSERT_SAME_TYPE(U, std::remove_cvref_t<T>);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
|
|
@ -52,7 +52,7 @@ struct test_invoke_result<Fn(Args...), Ret>
|
|||
{
|
||||
static_assert(std::is_invocable<Fn, Args...>::value, "");
|
||||
static_assert(std::is_invocable_r<Ret, Fn, Args...>::value, "");
|
||||
static_assert((std::is_same<typename std::invoke_result<Fn, Args...>::type, Ret>::value), "");
|
||||
ASSERT_SAME_TYPE(Ret, typename std::invoke_result<Fn, Args...>::type);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
@ -60,7 +60,7 @@ struct test_invoke_result<Fn(Args...), Ret>
|
|||
template <class T, class U>
|
||||
void test_result_of()
|
||||
{
|
||||
static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::result_of<T>::type);
|
||||
#if TEST_STD_VER > 14
|
||||
test_invoke_result<T, U>::call();
|
||||
#endif
|
||||
|
|
|
@ -37,8 +37,8 @@ struct test_invoke_result<Fn(Args...), Ret>
|
|||
{
|
||||
static_assert(std::is_invocable<Fn, Args...>::value, "");
|
||||
static_assert(std::is_invocable_r<Ret, Fn, Args...>::value, "");
|
||||
static_assert((std::is_same<typename std::invoke_result<Fn, Args...>::type, Ret>::value), "");
|
||||
static_assert((std::is_same<std::invoke_result_t<Fn, Args...>, Ret>::value), "");
|
||||
ASSERT_SAME_TYPE(Ret, typename std::invoke_result<Fn, Args...>::type);
|
||||
ASSERT_SAME_TYPE(Ret, std::invoke_result_t<Fn, Args...>);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
@ -46,9 +46,9 @@ struct test_invoke_result<Fn(Args...), Ret>
|
|||
template <class T, class U>
|
||||
void test_result_of_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::result_of<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::result_of_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::result_of_t<T>);
|
||||
#endif
|
||||
#if TEST_STD_VER > 14
|
||||
test_invoke_result<T, U>::call();
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
template <class T>
|
||||
void test_type_identity()
|
||||
{
|
||||
static_assert((std::is_same<typename std::type_identity<T>::type, T>::value), "");
|
||||
static_assert((std::is_same< std::type_identity_t<T>, T>::value), "");
|
||||
ASSERT_SAME_TYPE(T, typename std::type_identity<T>::type);
|
||||
ASSERT_SAME_TYPE(T, std::type_identity_t<T>);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
|
|
@ -29,27 +29,24 @@ enum F { W = UINT_MAX };
|
|||
|
||||
int main(int, char**)
|
||||
{
|
||||
static_assert((std::is_same<std::underlying_type<E>::type, int>::value),
|
||||
"E has the wrong underlying type");
|
||||
ASSERT_SAME_TYPE(int, std::underlying_type<E>::type);
|
||||
#if TEST_UNSIGNED_UNDERLYING_TYPE
|
||||
static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value),
|
||||
"F has the wrong underlying type");
|
||||
ASSERT_SAME_TYPE(unsigned, std::underlying_type<F>::type);
|
||||
#endif // TEST_UNSIGNED_UNDERLYING_TYPE
|
||||
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::underlying_type_t<E>, int>::value), "");
|
||||
ASSERT_SAME_TYPE(int, std::underlying_type_t<E>);
|
||||
#if TEST_UNSIGNED_UNDERLYING_TYPE
|
||||
static_assert((std::is_same<std::underlying_type_t<F>, unsigned>::value), "");
|
||||
ASSERT_SAME_TYPE(unsigned, std::underlying_type_t<F>);
|
||||
#endif // TEST_UNSIGNED_UNDERLYING_TYPE
|
||||
#endif // TEST_STD_VER > 11
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
enum G : char { };
|
||||
|
||||
static_assert((std::is_same<std::underlying_type<G>::type, char>::value),
|
||||
"G has the wrong underlying type");
|
||||
ASSERT_SAME_TYPE(char, std::underlying_type<G>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::underlying_type_t<G>, char>::value), "");
|
||||
ASSERT_SAME_TYPE(char, std::underlying_type_t<G>);
|
||||
#endif // TEST_STD_VER > 11
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
|
|
|
@ -19,27 +19,27 @@
|
|||
template <class T, class U>
|
||||
void test_add_pointer()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_pointer<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::add_pointer<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_pointer_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::add_pointer_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class F>
|
||||
void test_function0()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_pointer<F>::type, F*>::value), "");
|
||||
ASSERT_SAME_TYPE(F*, typename std::add_pointer<F>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_pointer_t<F>, F*>::value), "");
|
||||
ASSERT_SAME_TYPE(F*, std::add_pointer_t<F>);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class F>
|
||||
void test_function1()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_pointer<F>::type, F>::value), "");
|
||||
ASSERT_SAME_TYPE(F, typename std::add_pointer<F>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_pointer_t<F>, F>::value), "");
|
||||
ASSERT_SAME_TYPE(F, std::add_pointer_t<F>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
template <class T, class U>
|
||||
void test_remove_pointer()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_pointer<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::remove_pointer<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_pointer_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::remove_pointer_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
template <class T, class U>
|
||||
void test_add_lvalue_reference()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_lvalue_reference<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::add_lvalue_reference<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_lvalue_reference_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::add_lvalue_reference_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class F>
|
||||
void test_function0()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_lvalue_reference<F>::type, F&>::value), "");
|
||||
ASSERT_SAME_TYPE(F&, typename std::add_lvalue_reference<F>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_lvalue_reference_t<F>, F&>::value), "");
|
||||
ASSERT_SAME_TYPE(F&, std::add_lvalue_reference_t<F>);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class F>
|
||||
void test_function1()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_lvalue_reference<F>::type, F>::value), "");
|
||||
ASSERT_SAME_TYPE(F, typename std::add_lvalue_reference<F>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_lvalue_reference_t<F>, F>::value), "");
|
||||
ASSERT_SAME_TYPE(F, std::add_lvalue_reference_t<F>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -20,27 +20,27 @@
|
|||
template <class T, class U>
|
||||
void test_add_rvalue_reference()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::add_rvalue_reference<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_rvalue_reference_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::add_rvalue_reference_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class F>
|
||||
void test_function0()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_rvalue_reference<F>::type, F&&>::value), "");
|
||||
ASSERT_SAME_TYPE(F&&, typename std::add_rvalue_reference<F>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_rvalue_reference_t<F>, F&&>::value), "");
|
||||
ASSERT_SAME_TYPE(F&&, std::add_rvalue_reference_t<F>);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class F>
|
||||
void test_function1()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_rvalue_reference<F>::type, F>::value), "");
|
||||
ASSERT_SAME_TYPE(F, typename std::add_rvalue_reference<F>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_rvalue_reference_t<F>, F>::value), "");
|
||||
ASSERT_SAME_TYPE(F, std::add_rvalue_reference_t<F>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
template <class T, class U>
|
||||
void test_remove_reference()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::remove_reference<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_reference_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::remove_reference_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ enum HugeEnum : __uint128_t
|
|||
template <class T, class U>
|
||||
void test_make_signed()
|
||||
{
|
||||
static_assert((std::is_same<typename std::make_signed<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::make_signed<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::make_signed_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::make_signed_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ enum HugeEnum : __int128_t
|
|||
template <class T, class U>
|
||||
void test_make_unsigned()
|
||||
{
|
||||
static_assert((std::is_same<typename std::make_unsigned<T>::type, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, typename std::make_unsigned<T>::type);
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert((std::is_same<std::make_unsigned_t<T>, U>::value), "");
|
||||
ASSERT_SAME_TYPE(U, std::make_unsigned_t<T>);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -16,27 +16,34 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
template <class T>
|
||||
void test1()
|
||||
{
|
||||
static_assert( std::is_same<void, std::void_t<T>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<const T>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<volatile T>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<const volatile T>>::value, "");
|
||||
ASSERT_SAME_TYPE(void, std::void_t<T>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<const T>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<volatile T>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<const volatile T>);
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
void test2()
|
||||
{
|
||||
static_assert( std::is_same<void, std::void_t<T, U>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<const T, U>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<volatile T, U>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<const volatile T, U>>::value, "");
|
||||
ASSERT_SAME_TYPE(void, std::void_t<T, U>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<const T, U>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<volatile T, U>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<const volatile T, U>);
|
||||
|
||||
static_assert( std::is_same<void, std::void_t<T, const U>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<const T, const U>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<volatile T, const U>>::value, "");
|
||||
static_assert( std::is_same<void, std::void_t<const volatile T, const U>>::value, "");
|
||||
ASSERT_SAME_TYPE(void, std::void_t<U, T>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<U, const T>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<U, volatile T>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<U, const volatile T>);
|
||||
|
||||
ASSERT_SAME_TYPE(void, std::void_t<T, const U>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<const T, const U>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<volatile T, const U>);
|
||||
ASSERT_SAME_TYPE(void, std::void_t<const volatile T, const U>);
|
||||
}
|
||||
|
||||
class Class
|
||||
|
@ -47,7 +54,7 @@ public:
|
|||
|
||||
int main(int, char**)
|
||||
{
|
||||
static_assert( std::is_same<void, std::void_t<>>::value, "");
|
||||
ASSERT_SAME_TYPE(void, std::void_t<>);
|
||||
|
||||
test1<void>();
|
||||
test1<int>();
|
||||
|
@ -63,7 +70,7 @@ int main(int, char**)
|
|||
test2<Class&, bool>();
|
||||
test2<void *, int&>();
|
||||
|
||||
static_assert( std::is_same<void, std::void_t<int, double const &, Class, volatile int[], void>>::value, "");
|
||||
ASSERT_SAME_TYPE(void, std::void_t<int, double const &, Class, volatile int[], void>);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// type_traits
|
||||
|
||||
// void_t
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER <= 14
|
||||
# ifdef __cpp_lib_void_t
|
||||
# error Feature test macro should not be defined!
|
||||
# endif
|
||||
#else
|
||||
# ifndef __cpp_lib_void_t
|
||||
# error Feature test macro is not defined
|
||||
# endif
|
||||
# if __cpp_lib_void_t != 201411
|
||||
# error Feature test macro has the wrong value
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
#if defined(__cpp_lib_void_t)
|
||||
static_assert(std::is_same_v<std::void_t<int>, void>, "");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue