Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Redux: Backport C++17 type_traits and cuda::std::byte to C++14 #66

Merged
merged 13 commits into from
Nov 11, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
#include <cuda/std/type_traits>
#include "test_macros.h"

// XFAIL: c++98, c++03, c++11, c++14
// XFAIL: c++98, c++03, c++11

// If we're just building the test and not executing it, it should pass.
// UNSUPPORTED: no_execute

// cuda::std::byte is not an integer type, nor a character type.
// It is a distinct type for accessing the bits that ultimately make up object storage.

#if TEST_STD_VER > 17
#if TEST_STD_VER > 11
static_assert( cuda::std::is_trivial<cuda::std::byte>::value, "" ); // P0767
#else
static_assert( cuda::std::is_pod<cuda::std::byte>::value, "" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11

// <cuda/std/type_traits>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

int main(int, char**)
{
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
typedef cuda::std::bool_constant<true> _t;
static_assert(_t::value, "");
static_assert((cuda::std::is_same<_t::value_type, bool>::value), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: c++98, c++03, c++11
// type_traits

// template<class... B> struct conjunction; // C++17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: c++98, c++03, c++11
// type_traits

// template<class... B> struct disjunction; // C++17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: c++98, c++03, c++11
// type_traits

// template<class B> struct negation; // C++17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_is_base_of()
static_assert((cuda::std::is_base_of<const T, U>::value), "");
static_assert((cuda::std::is_base_of<T, const U>::value), "");
static_assert((cuda::std::is_base_of<const T, const U>::value), "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert((cuda::std::is_base_of_v<T, U>), "");
static_assert((cuda::std::is_base_of_v<const T, U>), "");
static_assert((cuda::std::is_base_of_v<T, const U>), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void test_is_base_of()
static_assert((cuda::std::is_base_of<const T, U>::value), "");
static_assert((cuda::std::is_base_of<T, const U>::value), "");
static_assert((cuda::std::is_base_of<const T, const U>::value), "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert((cuda::std::is_base_of_v<T, U>), "");
static_assert((cuda::std::is_base_of_v<const T, U>), "");
static_assert((cuda::std::is_base_of_v<T, const U>), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void test_is_convertible()
static_assert((cuda::std::is_convertible<const T, U>::value), "");
static_assert((cuda::std::is_convertible<T, const U>::value), "");
static_assert((cuda::std::is_convertible<const T, const U>::value), "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert((cuda::std::is_convertible_v<T, U>), "");
static_assert((cuda::std::is_convertible_v<const T, U>), "");
static_assert((cuda::std::is_convertible_v<T, const U>), "");
Expand All @@ -37,7 +37,7 @@ void test_is_not_convertible()
static_assert((!cuda::std::is_convertible<const T, U>::value), "");
static_assert((!cuda::std::is_convertible<T, const U>::value), "");
static_assert((!cuda::std::is_convertible<const T, const U>::value), "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert((!cuda::std::is_convertible_v<T, U>), "");
static_assert((!cuda::std::is_convertible_v<const T, U>), "");
static_assert((!cuda::std::is_convertible_v<T, const U>), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: c++98, c++03, c++11

// XFAIL: nvcc
// FIXME: Triage and fix this.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//

// <cuda/std/type_traits>
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11

#include <cuda/std/type_traits>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: c++98, c++03, c++11

// XFAIL: nvcc
// FIXME: Triage and fix this.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_is_same()
static_assert((!cuda::std::is_same<const T, U>::value), "");
static_assert((!cuda::std::is_same<T, const U>::value), "");
static_assert(( cuda::std::is_same<const T, const U>::value), "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert(( cuda::std::is_same_v<T, U>), "");
static_assert((!cuda::std::is_same_v<const T, U>), "");
static_assert((!cuda::std::is_same_v<T, const U>), "");
Expand All @@ -38,7 +38,7 @@ void test_is_same_ref()
static_assert((cuda::std::is_same<const T, U>::value), "");
static_assert((cuda::std::is_same<T, const U>::value), "");
static_assert((cuda::std::is_same<const T, const U>::value), "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert((cuda::std::is_same_v<T, U>), "");
static_assert((cuda::std::is_same_v<const T, U>), "");
static_assert((cuda::std::is_same_v<T, const U>), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11

// type_traits

Expand All @@ -17,6 +17,7 @@
#include "test_macros.h"

template <class T, class U>
__host__ __device__
void test_remove_cvref()
{
ASSERT_SAME_TYPE(U, typename cuda::std::remove_cvref<T>::type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct HasType : cuda::std::false_type {};
template <class T>
struct HasType<T, typename Voider<typename T::type>::type> : cuda::std::true_type {};

#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
template <typename T, typename U>
struct test_invoke_result;

Expand All @@ -68,12 +68,12 @@ __host__ __device__
void test_result_of()
{
ASSERT_SAME_TYPE(U, typename cuda::std::result_of<T>::type);
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
test_invoke_result<T, U>::call();
#endif
}

#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
template <typename T>
struct test_invoke_no_result;

Expand All @@ -96,7 +96,7 @@ void test_no_result()
#if TEST_STD_VER >= 11
static_assert((!HasType<cuda::std::result_of<T> >::value), "");
#endif
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
test_invoke_no_result<T>::call();
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct wat
struct F {};
struct FD : public F {};

#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
template <typename T, typename U>
struct test_invoke_result;

Expand All @@ -57,7 +57,7 @@ void test_result_of_imp()
#if TEST_STD_VER > 11
ASSERT_SAME_TYPE(U, cuda::std::result_of_t<T>);
#endif
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
test_invoke_result<T, U>::call();
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11

// type_traits

Expand All @@ -16,6 +16,7 @@
#include "test_macros.h"

template <class T>
__host__ __device__
void test_type_identity()
{
ASSERT_SAME_TYPE(T, typename cuda::std::type_identity<T>::type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void test_alignment_of()
static_assert( cuda::std::alignment_of<const T>::value == A, "");
static_assert( cuda::std::alignment_of<volatile T>::value == A, "");
static_assert( cuda::std::alignment_of<const volatile T>::value == A, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::alignment_of_v<T> == A, "");
static_assert( cuda::std::alignment_of_v<const T> == A, "");
static_assert( cuda::std::alignment_of_v<volatile T> == A, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_extent()
static_assert((cuda::std::extent<const T>::value == A), "");
static_assert((cuda::std::extent<volatile T>::value == A), "");
static_assert((cuda::std::extent<const volatile T>::value == A), "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert((cuda::std::extent_v<T> == A), "");
static_assert((cuda::std::extent_v<const T> == A), "");
static_assert((cuda::std::extent_v<volatile T> == A), "");
Expand All @@ -38,7 +38,7 @@ void test_extent1()
static_assert((cuda::std::extent<const T, 1>::value == A), "");
static_assert((cuda::std::extent<volatile T, 1>::value == A), "");
static_assert((cuda::std::extent<const volatile T, 1>::value == A), "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert((cuda::std::extent_v<T, 1> == A), "");
static_assert((cuda::std::extent_v<const T, 1> == A), "");
static_assert((cuda::std::extent_v<volatile T, 1> == A), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_rank()
static_assert( cuda::std::rank<const T>::value == A, "");
static_assert( cuda::std::rank<volatile T>::value == A, "");
static_assert( cuda::std::rank<const volatile T>::value == A, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::rank_v<T> == A, "");
static_assert( cuda::std::rank_v<const T> == A, "");
static_assert( cuda::std::rank_v<volatile T> == A, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// void_t

// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: c++98, c++03, c++11

// XFAIL: gcc-5.1, gcc-5.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_is_array()
static_assert( cuda::std::is_array<const T>::value, "");
static_assert( cuda::std::is_array<volatile T>::value, "");
static_assert( cuda::std::is_array<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::is_array_v<T>, "");
static_assert( cuda::std::is_array_v<const T>, "");
static_assert( cuda::std::is_array_v<volatile T>, "");
Expand All @@ -38,7 +38,7 @@ void test_is_not_array()
static_assert(!cuda::std::is_array<const T>::value, "");
static_assert(!cuda::std::is_array<volatile T>::value, "");
static_assert(!cuda::std::is_array<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert(!cuda::std::is_array_v<T>, "");
static_assert(!cuda::std::is_array_v<const T>, "");
static_assert(!cuda::std::is_array_v<volatile T>, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_is_class()
static_assert( cuda::std::is_class<const T>::value, "");
static_assert( cuda::std::is_class<volatile T>::value, "");
static_assert( cuda::std::is_class<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::is_class_v<T>, "");
static_assert( cuda::std::is_class_v<const T>, "");
static_assert( cuda::std::is_class_v<volatile T>, "");
Expand All @@ -38,7 +38,7 @@ void test_is_not_class()
static_assert(!cuda::std::is_class<const T>::value, "");
static_assert(!cuda::std::is_class<volatile T>::value, "");
static_assert(!cuda::std::is_class<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert(!cuda::std::is_class_v<T>, "");
static_assert(!cuda::std::is_class_v<const T>, "");
static_assert(!cuda::std::is_class_v<volatile T>, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_is_enum()
static_assert( cuda::std::is_enum<const T>::value, "");
static_assert( cuda::std::is_enum<volatile T>::value, "");
static_assert( cuda::std::is_enum<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::is_enum_v<T>, "");
static_assert( cuda::std::is_enum_v<const T>, "");
static_assert( cuda::std::is_enum_v<volatile T>, "");
Expand All @@ -38,7 +38,7 @@ void test_is_not_enum()
static_assert(!cuda::std::is_enum<const T>::value, "");
static_assert(!cuda::std::is_enum<volatile T>::value, "");
static_assert(!cuda::std::is_enum<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert(!cuda::std::is_enum_v<T>, "");
static_assert(!cuda::std::is_enum_v<const T>, "");
static_assert(!cuda::std::is_enum_v<volatile T>, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void test_is_floating_point()
static_assert( cuda::std::is_floating_point<const T>::value, "");
static_assert( cuda::std::is_floating_point<volatile T>::value, "");
static_assert( cuda::std::is_floating_point<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::is_floating_point_v<T>, "");
static_assert( cuda::std::is_floating_point_v<const T>, "");
static_assert( cuda::std::is_floating_point_v<volatile T>, "");
Expand All @@ -40,7 +40,7 @@ void test_is_not_floating_point()
static_assert(!cuda::std::is_floating_point<const T>::value, "");
static_assert(!cuda::std::is_floating_point<volatile T>::value, "");
static_assert(!cuda::std::is_floating_point<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert(!cuda::std::is_floating_point_v<T>, "");
static_assert(!cuda::std::is_floating_point_v<const T>, "");
static_assert(!cuda::std::is_floating_point_v<volatile T>, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct test_is_function {
static_assert( cuda::std::is_function<const T>::value, "");
static_assert( cuda::std::is_function<volatile T>::value, "");
static_assert( cuda::std::is_function<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::is_function_v<T>, "");
static_assert( cuda::std::is_function_v<const T>, "");
static_assert( cuda::std::is_function_v<volatile T>, "");
Expand All @@ -40,7 +40,7 @@ struct test_is_not_function {
static_assert(!cuda::std::is_function<const T>::value, "");
static_assert(!cuda::std::is_function<volatile T>::value, "");
static_assert(!cuda::std::is_function<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert(!cuda::std::is_function_v<T>, "");
static_assert(!cuda::std::is_function_v<const T>, "");
static_assert(!cuda::std::is_function_v<volatile T>, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_is_integral()
static_assert( cuda::std::is_integral<const T>::value, "");
static_assert( cuda::std::is_integral<volatile T>::value, "");
static_assert( cuda::std::is_integral<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::is_integral_v<T>, "");
static_assert( cuda::std::is_integral_v<const T>, "");
static_assert( cuda::std::is_integral_v<volatile T>, "");
Expand All @@ -38,7 +38,7 @@ void test_is_not_integral()
static_assert(!cuda::std::is_integral<const T>::value, "");
static_assert(!cuda::std::is_integral<volatile T>::value, "");
static_assert(!cuda::std::is_integral<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert(!cuda::std::is_integral_v<T>, "");
static_assert(!cuda::std::is_integral_v<const T>, "");
static_assert(!cuda::std::is_integral_v<volatile T>, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void test_is_lvalue_reference()
static_assert( cuda::std::is_lvalue_reference<const T>::value, "");
static_assert( cuda::std::is_lvalue_reference<volatile T>::value, "");
static_assert( cuda::std::is_lvalue_reference<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert( cuda::std::is_lvalue_reference_v<T>, "");
static_assert( cuda::std::is_lvalue_reference_v<const T>, "");
static_assert( cuda::std::is_lvalue_reference_v<volatile T>, "");
Expand All @@ -38,7 +38,7 @@ void test_is_not_lvalue_reference()
static_assert(!cuda::std::is_lvalue_reference<const T>::value, "");
static_assert(!cuda::std::is_lvalue_reference<volatile T>::value, "");
static_assert(!cuda::std::is_lvalue_reference<const volatile T>::value, "");
#if TEST_STD_VER > 14
#if TEST_STD_VER > 11
static_assert(!cuda::std::is_lvalue_reference_v<T>, "");
static_assert(!cuda::std::is_lvalue_reference_v<const T>, "");
static_assert(!cuda::std::is_lvalue_reference_v<volatile T>, "");
Expand Down
Loading