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

Modularize <type_traits> #335

Merged
merged 140 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
6df74ff
Move `add_const` into its own file
miscco Nov 29, 2022
2530c72
Move `add_cv` into its own file
miscco Nov 29, 2022
b3cecd1
Move `add_volatile` into its own file
miscco Nov 29, 2022
1225e49
Move `conditional` into its own file
miscco Nov 29, 2022
b992260
Move `__dependent_type` into its own file
miscco Nov 29, 2022
cae65e4
Move `enable_if` into its own file
miscco Nov 29, 2022
f82b7c0
Move `integral_constant` and `bool_constant` into their own files
miscco Nov 29, 2022
4f409e3
Move `_Lazy` into its own file
miscco Nov 29, 2022
0286b31
Move `__nat` into its own file
miscco Nov 29, 2022
2d214a3
Move `remove_all_extents` into its own file
miscco Nov 29, 2022
d8b6a25
Move `remove_const` into its own file
miscco Nov 29, 2022
e79b08d
Move `remove_extent` into its own file
miscco Nov 29, 2022
1796818
Move `remove_pointer` into its own file
miscco Nov 29, 2022
4d13e79
Move `remove_reference` into its own file
miscco Nov 29, 2022
a667b58
Move `remove_volatile` into its own file
miscco Nov 29, 2022
77057a3
Add `remove_const_ref`
miscco Nov 29, 2022
b71b55c
Move `remove_cv` into its own file
miscco Nov 29, 2022
c1f4550
Move `type_identity` into its own file
miscco Nov 29, 2022
bbe6823
Move `__type_list` into its own file
miscco Nov 29, 2022
992af0a
Move `void_t` into its owwn file
miscco Nov 29, 2022
0f1b1e4
Move `aligned_storage` into its own file
miscco Nov 29, 2022
7c32936
Move `aligned_union` into its own file
miscco Nov 29, 2022
5260be5
Move `alignment_of` into its own file
miscco Nov 29, 2022
74e5da1
Move `conjunction` into its own file
miscco Nov 29, 2022
d2a3ced
Add `copy_cv` functionality
miscco Nov 29, 2022
9a85bc7
Move `disjunction` into its own file
miscco Nov 29, 2022
0799b3d
Move `extent` into its own file
miscco Nov 29, 2022
7999610
Move `has_unique_object_representation` into its own file
miscco Nov 29, 2022
c68a825
Move `has_virtual_destructor` into its own file
miscco Nov 29, 2022
337e3ab
Move `is_abstract` into its own file
miscco Nov 29, 2022
f636581
Move `is_aggregate` into its own file
miscco Nov 29, 2022
0207bd1
Move `is_array` into its own file
miscco Nov 29, 2022
f0c0b56
Move `declval` into its own file
miscco Nov 29, 2022
b391107
Move `is_base_of` into its own file
miscco Nov 29, 2022
c2ae6a6
Move `is_bounded_array` into its own file
miscco Nov 29, 2022
aa43122
Add `__is_calllable` helper
miscco Nov 29, 2022
0e25c4f
Move `is_const` into its own file
miscco Nov 29, 2022
eb6c3af
Move `is_constant_evaluated` into its own file
miscco Nov 29, 2022
d43b680
Add `__is_core_convertible` helper
miscco Nov 29, 2022
b3b60c4
Move `is_empty` into its own file
miscco Nov 29, 2022
5136bf1
Move `is_final` into its own file
miscco Nov 29, 2022
953ca0c
Move `is_floating_point` into its own file
miscco Nov 29, 2022
f39ef0d
Move `is_integral` to its own file
miscco Nov 29, 2022
e6f1f0a
Move `is_null_pointer` into its own file
miscco Nov 29, 2022
71bfaa4
Move `is_pointer` into its own file
miscco Nov 29, 2022
7adee24
Move `is_polymorphic` into its own file
miscco Nov 29, 2022
af0c0fc
Move `__is_reference_wrapper` into its own file
miscco Nov 29, 2022
244622b
Move `is_reference` and friends into their own file
miscco Nov 29, 2022
003e339
Move `is_same` into its own file
miscco Nov 29, 2022
0fdb5d9
Move `__libcpp_is_referenceable` into its own file
miscco Nov 29, 2022
198e568
Add `__libcpp_is_signed_integer` trait
miscco Nov 29, 2022
0448c41
Move `is_arithmetic` into its own file
miscco Nov 29, 2022
ebe1901
Move `is_signed` into its own file
miscco Nov 29, 2022
0c728de
Move `is_standard_layout` to its own file
miscco Nov 29, 2022
cebbfbb
Move `is_unbounded_array` into its own file
miscco Nov 29, 2022
8728657
Move `is_union` into its own file
miscco Nov 29, 2022
ddf6e2e
Add `__libcpp_is_unsigned_integer` helper trait
miscco Nov 29, 2022
24be2d1
Move `_IsValidExpansion` into its own file
miscco Nov 29, 2022
b23ccf7
Move `is_void` into its own file
miscco Nov 29, 2022
d28329a
Move `is_volatile` into its own file
miscco Nov 29, 2022
2efef59
Add `__make_const_lvalue_ref` helper
miscco Nov 29, 2022
573f805
Add `__maybe_const` helper
miscco Nov 29, 2022
610b7fc
Move `negation` into its own file
miscco Nov 29, 2022
09c6492
Move `promote` into its own file
miscco Nov 29, 2022
d14b1fb
Move `rank` to its own file
miscco Nov 29, 2022
3e5b232
Move `remove_cvref` into its own file
miscco Nov 29, 2022
72ac3b7
Move `is_assignable` into its own file
miscco Nov 29, 2022
3fa7919
Move `is_class` to its own file
miscco Nov 29, 2022
76e4f20
Move `add_lvalue_reference` into its own file
miscco Nov 29, 2022
fc191e7
Move `add_pointer` into its own file
miscco Nov 29, 2022
0be4117
Move `add_rvalue_reference` into its own file
miscco Nov 29, 2022
c5c6835
Move `__apply_cv` into its own file
miscco Nov 29, 2022
5c27dff
Add `__copy_cvref` helper
miscco Nov 29, 2022
dc64717
Move `is_allocator` into its own file
miscco Nov 29, 2022
3923fcc
Move `is_function` into its own file
miscco Nov 29, 2022
476794e
Move `is_member_function_pointer` to its own file
miscco Nov 29, 2022
5405da1
Move `is_member_pointer` to its own file
miscco Nov 29, 2022
18ee3ce
Move `is_member_object_pointer` into its own file
miscco Nov 29, 2022
60b3d32
Move `is_enum` into its own file
miscco Nov 29, 2022
e14318d
Move `is_destructible` into its own file
miscco Nov 29, 2022
5997b3f
Move `decay` into its own file
miscco Nov 29, 2022
d1033cc
Move `common_type` into its own file
miscco Nov 29, 2022
db506f2
Move `is_fundamental` into its own file
miscco Nov 29, 2022
391b0e7
Move `is_compound` into its own file
miscco Nov 29, 2022
49736e8
Move `is_convertible` into its own file
miscco Nov 29, 2022
8773dda
Move `is_copy_assignable` into its own file
miscco Nov 29, 2022
494caf5
Move `is_constructible` into its own file
miscco Nov 29, 2022
5203d23
Move `is_copy_constructible` into its own file
miscco Nov 29, 2022
4a7eabe
Move `is_default_constructible` into its own file
miscco Nov 29, 2022
643b7fc
Move `is_implicitly_default_constructible` into its own file
miscco Nov 29, 2022
6b40939
Move `is_move_assignable` into its own file
miscco Nov 29, 2022
a7ea58c
Move `is_move_constructible` into its own file
miscco Nov 29, 2022
391d616
Move `is_scalar` into its own file
miscco Nov 29, 2022
a34245d
Move `is_literal_type` into its own file
miscco Nov 29, 2022
05b6409
Move `is_nothrow_assignable` into its own file
miscco Nov 29, 2022
5b57154
Move `is_nothrow_constructible` into its own file
miscco Nov 29, 2022
c9a6de3
Move `is_nothrow_convertible` into its own file
miscco Nov 29, 2022
353a531
Move `is_nothrow_copy_assignable` into its own file
miscco Nov 29, 2022
f4eab0c
Move `is_nothrow_copy_constructible` into its own file
miscco Nov 29, 2022
85d1651
Move `is_nothrow_default_constructible` into its own file
miscco Nov 29, 2022
8067249
Move `is_nothrow_destructible` into its own file
miscco Nov 29, 2022
ce80027
Move `is_nothrow_move_assignable` into its own file
miscco Nov 29, 2022
c23060b
Move `is_nothrow_move_constructible` into its own file
miscco Nov 29, 2022
bc37168
Move `is_unsigned` to its own file
miscco Nov 30, 2022
29d2967
Move `make_signed` to its own file
miscco Nov 30, 2022
b7757b4
Move `make_unsigned` into its own file
miscco Nov 30, 2022
3608608
Add helper `__make_32_64_or_128_bit_t`
miscco Nov 30, 2022
a50a65b
Move `underlying_type` into its own file
miscco Nov 30, 2022
ed40e4f
Move `is_swappable` into its own file
miscco Nov 30, 2022
d758cb6
Move `move` into its own file
miscco Nov 30, 2022
6898986
Move `swap` into its own file
miscco Nov 30, 2022
39a120b
Move `forward` into its own file
miscco Nov 30, 2022
678f28a
Move `is_object` into its own file
miscco Nov 30, 2022
4847479
Add `is_primary_template` helper
miscco Nov 30, 2022
307ceaa
Add `is_scoped_enum` trait
miscco Nov 30, 2022
738e397
Move `is_trivially_constructible` into its own file
miscco Nov 30, 2022
183a309
Move `is_trivially_default_constructible` into its own file
miscco Nov 30, 2022
fd79af1
Move `is_trivially_copy_constructible` into its own file
miscco Nov 30, 2022
9e459ba
Move `is_trivially_move_constructible` into its own file
miscco Nov 30, 2022
4cc8810
Move `is_trivially_assignable` into its own file
miscco Nov 30, 2022
7b6a284
Move `is_trivially_copy_assignable` into its own file
miscco Nov 30, 2022
6409f00
Move `is_trivially_move_assignable` into its own file
miscco Nov 30, 2022
6497757
Move `is_trivially_destructible` into its own file
miscco Nov 30, 2022
a6842f5
Move `is_trivially_copyable` into its own file
miscco Nov 30, 2022
c8fb119
Move `is_trivial` into its own file
miscco Nov 30, 2022
d653fe5
Move `is_pod` into its own file
miscco Nov 29, 2022
8ba6464
Move `_IsCharLikeType` into its own file
miscco Nov 29, 2022
48c25b9
Move `invoke` into its own file
miscco Nov 30, 2022
1656a57
Move `result_of` into its own file
miscco Nov 30, 2022
6c58273
Move `__convert_to_integral` into its own file
miscco Nov 30, 2022
961f1c0
Move `can_extract_pair` into its own file
miscco Nov 30, 2022
023c1c5
Move `addressof` into its own file
miscco Nov 14, 2022
42604d9
Move `identity` into its own file
miscco Nov 30, 2022
0a052fe
Add files to CMakeList.txt
miscco Nov 30, 2022
565211b
Add a `__decay_t` alias
miscco Dec 1, 2022
7acf2f4
Use `__add_lvalue_reference_t` throughout
miscco Dec 1, 2022
82d0717
Use `__libcpp_remove_reference_t` consistently
miscco Dec 1, 2022
4c24dc6
Use `__remove_const_t` consistently
miscco Dec 1, 2022
37b503d
Use `__remove_cv_t` consistently
miscco Dec 1, 2022
4c38345
Address review comments and apply fixes for CI
miscco Dec 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
230 changes: 115 additions & 115 deletions .upstream-tests/test/libcxx/utilities/meta/is_referenceable.pass.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
/// described in the previous item;
/// (1.5) - f(t1, t2, ..., tN) in all other cases.

#define _LIBCUDACXX_ENABLE_CXX20_REMOVED_TYPE_TRAITS
#define _LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS

#include <cuda/std/functional>
#include <cuda/std/type_traits>
#include <cuda/std/utility> // for cuda::std::move
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//===----------------------------------------------------------------------===//
//
// 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
// SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
//===----------------------------------------------------------------------===//

// <cuda/std/memory>

// template <ObjectType T> T* addressof(T& r);

#include <cuda/std/type_traits>
#include <cuda/std/cassert>

#include "test_macros.h"

struct A
{
__host__ __device__ void operator&() const {}
};

struct nothing {
__host__ __device__ operator char&()
{
static char c;
return c;
}
};

int main(int, char**)
{
{
int i;
double d;
assert(cuda::std::addressof(i) == &i);
assert(cuda::std::addressof(d) == &d);
A* tp = new A;
const A* ctp = tp;
assert(cuda::std::addressof(*tp) == tp);
assert(cuda::std::addressof(*ctp) == tp);
delete tp;
}
{
union
{
nothing n;
int i;
};
assert(cuda::std::addressof(n) == (void*)cuda::std::addressof(i));
}

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//===----------------------------------------------------------------------===//
//
// 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
// SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++11
// UNSUPPORTED: nvrtc

// <memory>

// template <ObjectType T> T* addressof(T&& r) = delete;

#include <cuda/std/type_traits>
#include <cuda/std/cassert>

#include "test_macros.h"

int main(int, char**)
{
const int *p = cuda::std::addressof<const int>(0);

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//===----------------------------------------------------------------------===//
//
// 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
// SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
//===----------------------------------------------------------------------===//

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

// <memory>

// template <ObjectType T> constexpr T* addressof(T& r);

#include <cuda/std/type_traits>
#include <cuda/std/cassert>

#include "test_macros.h"

#if defined(_LIBCUDACXX_ADDRESSOF) || defined(__NVCOMPILER)
struct Pointer {
__host__ __device__ constexpr Pointer(void* v) : value(v) {}
void* value;
};

struct A
{
__host__ __device__ constexpr A() : n(42) {}
__host__ __device__ void operator&() const { }
int n;
};

__device__ constexpr int i = 0;
static_assert(cuda::std::addressof(i) == &i, "");

__device__ constexpr double d = 0.0;
static_assert(cuda::std::addressof(d) == &d, "");

#ifndef __CUDA_ARCH__ // fails in __cudaRegisterVariable
__device__ constexpr A a{};
__device__ constexpr const A* ap = cuda::std::addressof(a);
static_assert(&(ap->n) == &(a.n), "");
#endif
#endif

int main(int, char**)
{
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

// #include <cuda/std/functional>
// #include <cuda/std/memory>
#include <cuda/std/tuple>
#include <cuda/std/type_traits>

#include "test_macros.h"
Expand All @@ -24,6 +25,13 @@ struct X { __host__ __device__ explicit X(T const&){} };
template <class T>
struct S { __host__ __device__ explicit S(T const&){} };

template <class T>
struct bad_reference_wrapper {
__host__ __device__ bad_reference_wrapper(T&);
bad_reference_wrapper(T&&) = delete;
__host__ __device__ operator T&() const;
};

_LIBCUDACXX_BEGIN_NAMESPACE_STD

template <typename T>
Expand Down Expand Up @@ -98,14 +106,17 @@ struct TernaryOp {
>::type type;
};

// (4.1)
// -- If sizeof...(T) is zero, there shall be no member type.
__host__ __device__
void test_bullet_one() {
static_assert(no_common_type<>::value, "");
}

// If sizeof...(T) is one, let T0 denote the sole type constituting the pack T.
// The member typedef-name type shall denote the same type as decay_t<T0>.
// (4.2)
// -- If sizeof...(T) is one, let T0 denote the sole type constituting the pack
// T. The member typedef-name type shall denote the same type, if any, as
// common_type_t<T0, T0>; otherwise there shall be no member type.
__host__ __device__
void test_bullet_two() {
static_assert((cuda::std::is_same<cuda::std::common_type<void>::type, void>::value), "");
Expand All @@ -128,11 +139,11 @@ void test_bullet_three_one_imp() {
static_assert((cuda::std::is_same<typename cuda::std::common_type<T, U>::type, typename cuda::std::common_type<DT, DU>::type>::value), "");
}

// (3.3)
// (4.3)
// -- If sizeof...(T) is two, let the first and second types constituting T be
// denoted by T1 and T2, respectively, and let D1 and D2 denote the same types
// as decay_t<T1> and decay_t<T2>, respectively.
// (3.3.1)
// (4.3.1)
// -- If is_same_v<T1, D1> is false or is_same_v<T2, D2> is false, let C
// denote the same type, if any, as common_type_t<D1, D2>.
__host__ __device__
Expand Down Expand Up @@ -167,17 +178,20 @@ void test_bullet_three_one() {
}
}

// (3.3)
// (4.3)
// -- If sizeof...(T) is two, let the first and second types constituting T be
// denoted by T1 and T2, respectively, and let D1 and D2 denote the same types
// as decay_t<T1> and decay_t<T2>, respectively.
// (3.3.1)
// (4.3.1)
// -- If [...]
// (3.3.2)
// -- Otherwise, let C denote the same type, if any, as
// (4.3.2)
// -- [Note: [...]
// (4.3.3)
// -- Otherwise, if
// decay_t<decltype(false ? declval<D1>() : declval<D2>())>
// denotes a type, let C denote that type.
__host__ __device__
void test_bullet_three_two() {
void test_bullet_three_three() {
{
typedef int const* T1;
typedef int* T2;
Expand Down Expand Up @@ -211,7 +225,38 @@ void test_bullet_three_two() {
}
}

// (3.4)
// (4.3)
// -- If sizeof...(T) is two, let the first and second types constituting T be
// denoted by T1 and T2, respectively, and let D1 and D2 denote the same types
// as decay_t<T1> and decay_t<T2>, respectively.
// (4.3.1)
// -- If [...]
// (4.3.2)
// -- [Note: [...]
// (4.3.3)
// -- Otherwise
// (4.3.4)
// -- Otherwise, if COND-RES(CREF(D1), CREF(D2)) denotes a type, let C
// denote the type decay_t<COND-RES(CREF(D1), CREF(D2))>.
__host__ __device__
void test_bullet_three_four() {
#if TEST_STD_VER >= 20
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<int, bad_reference_wrapper<int>>, int>, "");
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<bad_reference_wrapper<double>, double>, double>, "");
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<const bad_reference_wrapper<double>, double>, double>, "");
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<volatile bad_reference_wrapper<double>, double>, double>, "");
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<const volatile bad_reference_wrapper<double>, double>, double>, "");

static_assert(cuda::std::is_same_v<cuda::std::common_type_t<bad_reference_wrapper<double>, const double>, double>, "");
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<bad_reference_wrapper<double>, volatile double>, double>, "");
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<bad_reference_wrapper<double>, const volatile double>, double>, "");

static_assert(cuda::std::is_same_v<cuda::std::common_type_t<bad_reference_wrapper<double>&, double>, double>, "");
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<bad_reference_wrapper<double>, double&>, double>, "");
#endif
}

// (4.4)
// -- If sizeof...(T) is greater than two, let T1, T2, and R, respectively,
// denote the first, second, and (pack of) remaining types constituting T.
// Let C denote the same type, if any, as common_type_t<T1, T2>. If there is
Expand All @@ -230,41 +275,15 @@ void test_bullet_four() {
}
}


// The example code specified in Note B for common_type
namespace note_b_example {

typedef bool (&PF1)();
typedef short (*PF2)(long);

struct S {
__host__ __device__
operator PF2() const;
__host__ __device__
double operator()(char, int&);
__host__ __device__
void fn(long) const;
char data;
#if TEST_STD_VER > 20
struct A {};
struct B {};
struct C : B {};
template<>
struct cuda::std::common_type<A, cuda::std::tuple<B>> {
using type = tuple<B>;
};

typedef void (S::*PMF)(long) const;
typedef char S::*PMD;

using cuda::std::is_same;
using cuda::std::result_of;
// using cuda::std::unique_ptr;

static_assert((is_same<result_of<S(int)>::type, short>::value), "Error!");
static_assert((is_same<result_of<S&(unsigned char, int&)>::type, double>::value), "Error!");
static_assert((is_same<result_of<PF1()>::type, bool>::value), "Error!");
//static_assert((is_same<result_of<PMF(unique_ptr<S>, int)>::type, void>::value), "Error!");
#if TEST_STD_VER >= 11
static_assert((is_same<result_of<PMD(S)>::type, char&&>::value), "Error!");
#endif
static_assert((is_same<result_of<PMD(const S*)>::type, const char&>::value), "Error!");

} // namespace note_b_example


int main(int, char**)
{
Expand Down Expand Up @@ -318,10 +337,12 @@ int main(int, char**)
static_assert((cuda::std::is_same<cuda::std::common_type<int, S<int>, S<int> >::type, S<int> >::value), "");
static_assert((cuda::std::is_same<cuda::std::common_type<int, int, S<int> >::type, S<int> >::value), "");


test_bullet_one();
test_bullet_two();
test_bullet_three_one();
test_bullet_three_two();
test_bullet_three_three();
test_bullet_three_four();
test_bullet_four();

// P0548
Expand All @@ -343,5 +364,29 @@ int main(int, char**)
static_assert(cuda::std::is_same<cuda::std::common_type<int, int, int, int, int, int, int, int>::type, int>::value, "");
#endif

#if 0 // TEST_STD_VER > 20 Not Implemented
// P2321
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::tuple<int>>, cuda::std::tuple<int>>);
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::tuple<int>, cuda::std::tuple<long>>, cuda::std::tuple<long>>);
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::tuple<const int>, cuda::std::tuple<const int>>, cuda::std::tuple<int>>);
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::tuple<const int&>>, cuda::std::tuple<int>>);
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::tuple<const volatile int&>, cuda::std::tuple<const volatile long&>>, cuda::std::tuple<long>>);

static_assert(cuda::std::is_same_v<cuda::std::common_type_t<A, cuda::std::tuple<B>, cuda::std::tuple<C>>, cuda::std::tuple<B>>);

static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::pair<int, int>>, cuda::std::pair<int, int>>);
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::pair<int, long>, cuda::std::pair<long, int>>, cuda::std::pair<long, long>>);
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::pair<const int, const long>,
cuda::std::pair<const int, const long>>,
cuda::std::pair<int, long>>);

static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::pair<const int&, const long&>>, cuda::std::pair<int, long>>);
static_assert(cuda::std::is_same_v<cuda::std::common_type_t<cuda::std::pair<const volatile int&, const volatile long&>,
cuda::std::pair<const volatile long&, const volatile int&>>,
cuda::std::pair<long, long>>);

static_assert(cuda::std::is_same_v<cuda::std::common_type_t<A, cuda::std::tuple<B>, cuda::std::tuple<C>>, cuda::std::tuple<B>>);
#endif

return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

// result_of<Fn(ArgTypes...)>

#define _LIBCUDACXX_ENABLE_CXX20_REMOVED_TYPE_TRAITS
#define _LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS

#include <cuda/std/type_traits>
// #include <cuda/std/memory>
#include <cuda/std/cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
//
// result_of<Fn(ArgTypes...)>

#define _LIBCUDACXX_ENABLE_CXX20_REMOVED_TYPE_TRAITS
#define _LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS

#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated

#include <cuda/std/type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

// is_literal_type

// is_literal_type has been deprecated in C++17
#pragma nv_diag_suppress 1215
miscco marked this conversation as resolved.
Show resolved Hide resolved

#include <cuda/std/type_traits>
#include <cuda/std/cstddef> // for cuda::std::nullptr_t
#include "test_macros.h"
Expand Down
Loading