diff --git a/.upstream-tests/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp b/.upstream-tests/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp index be48236e57..0226ac8d0f 100644 --- a/.upstream-tests/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp +++ b/.upstream-tests/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: nvrtc + // // // reference_wrapper diff --git a/.upstream-tests/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.compile.fail.cpp b/.upstream-tests/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.compile.fail.cpp index f6b99e996c..eda2731712 100644 --- a/.upstream-tests/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.compile.fail.cpp +++ b/.upstream-tests/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.compile.fail.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: nvrtc + // // reference_wrapper diff --git a/.upstream-tests/test/std/utilities/utility/as_const/as_const.compile.fail.cpp b/.upstream-tests/test/std/utilities/utility/as_const/as_const.compile.fail.cpp index aff4a66034..f32432ae45 100644 --- a/.upstream-tests/test/std/utilities/utility/as_const/as_const.compile.fail.cpp +++ b/.upstream-tests/test/std/utilities/utility/as_const/as_const.compile.fail.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11 +// UNSUPPORTED: nvrtc // template constexpr add_const& as_const(T& t) noexcept; // C++17 // template add_const& as_const(const T&&) = delete; // C++17 diff --git a/.upstream-tests/test/std/utilities/utility/declval/declval.pass.cpp b/.upstream-tests/test/std/utilities/utility/declval/declval.pass.cpp index e2a7cc6ac7..bf3b13894a 100644 --- a/.upstream-tests/test/std/utilities/utility/declval/declval.pass.cpp +++ b/.upstream-tests/test/std/utilities/utility/declval/declval.pass.cpp @@ -24,7 +24,7 @@ class A int main(int, char**) { - static_assert((std::is_same()), A&&>::value), ""); + static_assert((cuda::std::is_same()), A&&>::value), ""); return 0; } diff --git a/.upstream-tests/test/std/utilities/utility/exchange/exchange.pass.cpp b/.upstream-tests/test/std/utilities/utility/exchange/exchange.pass.cpp index 65b14ea656..717ba91140 100644 --- a/.upstream-tests/test/std/utilities/utility/exchange/exchange.pass.cpp +++ b/.upstream-tests/test/std/utilities/utility/exchange/exchange.pass.cpp @@ -25,6 +25,10 @@ #include "test_macros.h" +template +__host__ __device__ +constexpr bool unused(T &&) {return true;} + #if TEST_STD_VER > 11 __host__ __device__ TEST_CONSTEXPR_CXX14 bool test_constexpr() { int v = 12; @@ -57,17 +61,20 @@ __host__ __device__ TEST_CONSTEXPR_CXX14 bool test_noexcept() { assert(x == 42); } { - TestNoexcept x; + TestNoexcept x{}; ASSERT_NOEXCEPT(cuda::std::exchange(x, cuda::std::move(x))); ASSERT_NOT_NOEXCEPT(cuda::std::exchange(x, x)); // copy-assignment is not noexcept + unused(x); } { - TestNoexcept x; + TestNoexcept x{}; ASSERT_NOT_NOEXCEPT(cuda::std::exchange(x, cuda::std::move(x))); + unused(x); } { - TestNoexcept x; + TestNoexcept x{}; ASSERT_NOT_NOEXCEPT(cuda::std::exchange(x, cuda::std::move(x))); + unused(x); } return true; diff --git a/.upstream-tests/test/std/utilities/utility/forward/move.pass.cpp b/.upstream-tests/test/std/utilities/utility/forward/move.pass.cpp index cfc19369f5..35542b2d92 100644 --- a/.upstream-tests/test/std/utilities/utility/forward/move.pass.cpp +++ b/.upstream-tests/test/std/utilities/utility/forward/move.pass.cpp @@ -37,24 +37,14 @@ __device__ const int& cx = x; template __host__ __device__ QualInt get() TEST_NOEXCEPT { return static_cast(x); } -int copy_ctor = 0; -int move_ctor = 0; +_LIBCUDACXX_CPO_ACCESSIBILITY int copy_ctor = 0; +_LIBCUDACXX_CPO_ACCESSIBILITY int move_ctor = 0; struct A { - A() {} - A(const A&) {++copy_ctor;} - A(A&&) {++move_ctor;} - A& operator=(const A&) = delete; -}; - -__device__ int device_copy_ctor = 0; -__device__ int device_move_ctor = 0; - -struct D { - __device__ D() {} - __device__ D(const D&) {++device_copy_ctor;} - __device__ D(D&&) {++device_move_ctor;} - __device__ D& operator=(const D&) = delete; + __host__ __device__ A() {} + __host__ __device__ A(const A&) {++copy_ctor;} + __host__ __device__ A(A&&) {++move_ctor;} + __host__ __device__ A& operator=(const A&) = delete; }; #if TEST_STD_VER > 11 @@ -79,7 +69,6 @@ int main(int, char**) static_assert(cuda::std::is_same())), const int&&>::value, ""); ASSERT_NOEXCEPT(cuda::std::move(get())); } -#ifndef __CUDA_ARCH__ { // test copy and move semantics A a; const A ca = A(); @@ -103,31 +92,6 @@ int main(int, char**) assert(copy_ctor == 3); assert(move_ctor == 1); } -#else - { // test copy and move semantics - D d; - const D cd = D(); - - assert(device_copy_ctor == 0); - assert(device_move_ctor == 0); - - D d2 = d; (void)d2; - assert(device_copy_ctor == 1); - assert(device_move_ctor == 0); - - D d3 = cuda::std::move(d); (void)d3; - assert(device_copy_ctor == 1); - assert(device_move_ctor == 1); - - D d4 = cd; (void)d4; - assert(device_copy_ctor == 2); - assert(device_move_ctor == 1); - - D d5 = cuda::std::move(cd); (void)d5; - assert(device_copy_ctor == 3); - assert(device_move_ctor == 1); - } -#endif { // test on a move only type move_only mo; test(cuda::std::move(mo)); diff --git a/.upstream-tests/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp b/.upstream-tests/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp index 85004aa193..0c245d7548 100644 --- a/.upstream-tests/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp +++ b/.upstream-tests/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp @@ -24,6 +24,10 @@ #include "test_macros.h" +template +__host__ __device__ +constexpr bool unused(T &&) {return true;} + class A { __host__ __device__ A(const A&); @@ -44,10 +48,15 @@ int main(int, char**) { int i = 0; const int ci = 0; + unused(i); + unused(ci); legacy l; A a; const A ca; + unused(l); + unused(a); + unused(ca); static_assert((cuda::std::is_same::value), ""); static_assert((cuda::std::is_same::value), ""); @@ -61,7 +70,5 @@ int main(int, char**) static_assert(i2 == 23, "" ); #endif - ++i; - return 0; } diff --git a/include/cuda/std/detail/libcxx/include/__functional/reference_wrapper.h b/include/cuda/std/detail/libcxx/include/__functional/reference_wrapper.h index 53f69b99e5..bc1056c930 100644 --- a/include/cuda/std/detail/libcxx/include/__functional/reference_wrapper.h +++ b/include/cuda/std/detail/libcxx/include/__functional/reference_wrapper.h @@ -54,7 +54,7 @@ class _LIBCUDACXX_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 typename __invoke_of::type operator() (_ArgTypes&&... __args) const { - return std::__invoke(get(), std::forward<_ArgTypes>(__args)...); + return _CUDA_VSTD::__invoke(get(), _CUDA_VSTD::forward<_ArgTypes>(__args)...); } };