diff --git a/ci/build_libcudacxx.sh b/ci/build_libcudacxx.sh index da0c7ad4d4..f318796793 100755 --- a/ci/build_libcudacxx.sh +++ b/ci/build_libcudacxx.sh @@ -17,5 +17,5 @@ cmake -S .. -B ../build \ -DTHRUST_ENABLE_INSTALL_RULES=ON \ -G Ninja -LIBCUDACXX_SITE_CONFIG="../build/libcudacxx/test/lit.site.cfg" lit -v --no-progress-bar --no-execute -Dcompute_archs=${GPU_ARCHS} -Dstd="c++${CXX_STANDARD}" ../libcudacxx/.upstream-tests/test +LIBCUDACXX_SITE_CONFIG="../build/libcudacxx/test/lit.site.cfg" lit -v --no-progress-bar -Dexecutor="NoopExecutor()" -Dcompute_archs=${GPU_ARCHS} -Dstd="c++${CXX_STANDARD}" ../libcudacxx/.upstream-tests/test diff --git a/libcudacxx/.upstream-tests/test/cuda/barrier_native_handle.pass.cpp b/libcudacxx/.upstream-tests/test/cuda/barrier_native_handle.pass.cpp index c55e7fdc36..570630ed15 100644 --- a/libcudacxx/.upstream-tests/test/cuda/barrier_native_handle.pass.cpp +++ b/libcudacxx/.upstream-tests/test/cuda/barrier_native_handle.pass.cpp @@ -10,12 +10,13 @@ // UNSUPPORTED: pre-sm-80 -#pragma nv_diag_suppress static_var_with_dynamic_init -#pragma nv_diag_suppress set_but_not_used - #include #include "cuda_space_selector.h" +#include "test_macros.h" + +TEST_NV_DIAG_SUPPRESS(static_var_with_dynamic_init) +TEST_NV_DIAG_SUPPRESS(set_but_not_used) __device__ void test() diff --git a/libcudacxx/.upstream-tests/test/cuda/pipeline_arrive_on.pass.cpp b/libcudacxx/.upstream-tests/test/cuda/pipeline_arrive_on.pass.cpp index 7fb14eaee7..082260e00c 100644 --- a/libcudacxx/.upstream-tests/test/cuda/pipeline_arrive_on.pass.cpp +++ b/libcudacxx/.upstream-tests/test/cuda/pipeline_arrive_on.pass.cpp @@ -12,16 +12,18 @@ // Remove after bump to version 4 #define _LIBCUDACXX_CUDA_ABI_VERSION 3 -// TODO: Remove pointless comparison suppression when compiler fixes short-circuiting -#pragma nv_diag_suppress 186 - -#pragma nv_diag_suppress static_var_with_dynamic_init -#pragma nv_diag_suppress declared_but_not_referenced #include #include #include "cuda_space_selector.h" +#include "test_macros.h" + +// TODO: Remove pointless comparison suppression when compiler fixes short-circuiting +TEST_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero + +TEST_NV_DIAG_SUPPRESS(static_var_with_dynamic_init) +TEST_NV_DIAG_SUPPRESS(declared_but_not_referenced) using nvcuda::experimental::pipeline; diff --git a/libcudacxx/.upstream-tests/test/cuda/pipeline_arrive_on_abi_v2.pass.cpp b/libcudacxx/.upstream-tests/test/cuda/pipeline_arrive_on_abi_v2.pass.cpp index 1b773943ff..83431f1558 100644 --- a/libcudacxx/.upstream-tests/test/cuda/pipeline_arrive_on_abi_v2.pass.cpp +++ b/libcudacxx/.upstream-tests/test/cuda/pipeline_arrive_on_abi_v2.pass.cpp @@ -12,16 +12,17 @@ #define _LIBCUDACXX_CUDA_ABI_VERSION 2 -// TODO: Remove pointless comparison suppression when compiler fixes short-circuiting -#pragma nv_diag_suppress 186 - -#pragma nv_diag_suppress static_var_with_dynamic_init -#pragma nv_diag_suppress declared_but_not_referenced - #include #include #include "cuda_space_selector.h" +#include "test_macros.h" + +// TODO: Remove pointless comparison suppression when compiler fixes short-circuiting +TEST_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero + +TEST_NV_DIAG_SUPPRESS(static_var_with_dynamic_init) +TEST_NV_DIAG_SUPPRESS(declared_but_not_referenced) using nvcuda::experimental::pipeline; diff --git a/libcudacxx/.upstream-tests/test/cuda/pipeline_divergent_threads.pass.cpp b/libcudacxx/.upstream-tests/test/cuda/pipeline_divergent_threads.pass.cpp index 0411fa5738..147b263e6c 100644 --- a/libcudacxx/.upstream-tests/test/cuda/pipeline_divergent_threads.pass.cpp +++ b/libcudacxx/.upstream-tests/test/cuda/pipeline_divergent_threads.pass.cpp @@ -11,6 +11,7 @@ // UNSUPPORTED: pre-sm-70 // UNSUPPORTED: nvrtc +#include #include #include #include @@ -18,6 +19,11 @@ #include #include +#include "test_macros.h" + +TEST_NV_DIAG_SUPPRESS(static_var_with_dynamic_init) +TEST_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero + constexpr int nthreads = 256; constexpr size_t stages_count = 2; // Pipeline with two stages @@ -40,7 +46,6 @@ __global__ void with_staging(int* global_out, int const* global_in, size_t size, size_t shared_offset[stages_count] = { 0, block.size() }; // Offsets to each batch // Allocate shared storage for a two-stage cuda::pipeline: - #pragma nv_diag_suppress static_var_with_dynamic_init __shared__ cuda::pipeline_shared_state shared_state; auto pipeline = cuda::make_pipeline(block, &shared_state); diff --git a/libcudacxx/.upstream-tests/test/cuda/pipeline_group_concept.h b/libcudacxx/.upstream-tests/test/cuda/pipeline_group_concept.h index 4ec3fedcd6..5664ee0a13 100644 --- a/libcudacxx/.upstream-tests/test/cuda/pipeline_group_concept.h +++ b/libcudacxx/.upstream-tests/test/cuda/pipeline_group_concept.h @@ -11,9 +11,11 @@ // UNSUPPORTED: pre-sm-70 // TODO: Remove pointless comparison suppression when compiler fixes short-circuiting -#pragma nv_diag_suppress 186 #include +#include "test_macros.h" + +TEST_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero template struct single_thread_test_group { diff --git a/libcudacxx/.upstream-tests/test/libcxx/libcpp_alignof.pass.cpp b/libcudacxx/.upstream-tests/test/libcxx/libcpp_alignof.pass.cpp index b262964f86..5b159dc170 100644 --- a/libcudacxx/.upstream-tests/test/libcxx/libcpp_alignof.pass.cpp +++ b/libcudacxx/.upstream-tests/test/libcxx/libcpp_alignof.pass.cpp @@ -16,7 +16,7 @@ #include #include "test_macros.h" -#pragma nv_diag_suppress cuda_demote_unsupported_floating_point +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) template __host__ __device__ diff --git a/libcudacxx/.upstream-tests/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp b/libcudacxx/.upstream-tests/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp index 7bd1d81465..e26e7e3b87 100644 --- a/libcudacxx/.upstream-tests/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp @@ -13,11 +13,13 @@ // static constexpr bool is_always_lock_free; -#include #include +#include #include "test_macros.h" +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) + // NVRTC doesn't include host atomic making this feature test invalid // TODO: Should we define __cpp_lib_atomic_is_always_lock_free for NVRTC? #if !defined(__CUDACC_RTC__) @@ -97,7 +99,7 @@ void run() CHECK_ALWAYS_LOCK_FREE(void*); CHECK_ALWAYS_LOCK_FREE(float); CHECK_ALWAYS_LOCK_FREE(double); - CHECK_ALWAYS_LOCK_FREE(long double); + //CHECK_ALWAYS_LOCK_FREE(long double); // long double is not supported #if __has_attribute(vector_size) && defined(_LIBCUDACXX_VERSION) && !defined(__CUDACC__) // NOTE: NVCC doesn't support the vector_size attribute in device code. CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(1 * sizeof(int))))); diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.convertible/convertible_to.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.convertible/convertible_to.pass.cpp index 268f097498..6c2655ae75 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.convertible/convertible_to.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.convertible/convertible_to.pass.cpp @@ -11,7 +11,6 @@ // template // concept convertible_to; -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.copyconstructible/copy_constructible.compile.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.copyconstructible/copy_constructible.compile.pass.cpp index c45bf6ed9a..81c015ac0e 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.copyconstructible/copy_constructible.compile.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.copyconstructible/copy_constructible.compile.pass.cpp @@ -11,7 +11,6 @@ // template // concept copy_constructible; -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.moveconstructible/move_constructible.compile.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.moveconstructible/move_constructible.compile.pass.cpp index 9b87153464..f4d2998203 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.moveconstructible/move_constructible.compile.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.moveconstructible/move_constructible.compile.pass.cpp @@ -11,7 +11,6 @@ // template // concept move_constructible; -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" @@ -21,6 +20,7 @@ #include #include "type_classification/moveconstructible.h" +#include "test_macros.h" using cuda::std::move_constructible; diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.swappable/swappable.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.swappable/swappable.pass.cpp index 9acc9bf203..c70e2d294b 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.swappable/swappable.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.swappable/swappable.pass.cpp @@ -11,7 +11,6 @@ // template // concept swappable = // see below -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.swappable/swappable_with.compile.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.swappable/swappable_with.compile.pass.cpp index bd6de4f8cb..e1ee8d5c39 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.swappable/swappable_with.compile.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.lang/concept.swappable/swappable_with.compile.pass.cpp @@ -11,7 +11,6 @@ // template // concept swappable_with = // see below -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/copyable.compile.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/copyable.compile.pass.cpp index 60cd828655..7beff23c95 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/copyable.compile.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/copyable.compile.pass.cpp @@ -11,7 +11,6 @@ // template // concept copyable = see below; -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" @@ -21,6 +20,7 @@ #include #include "type_classification/copyable.h" +#include "test_macros.h" using cuda::std::copyable; diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/movable.compile.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/movable.compile.pass.cpp index 5552a19f17..cfdd00e27e 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/movable.compile.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/movable.compile.pass.cpp @@ -11,7 +11,6 @@ // template // concept movable = see below; -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/regular.compile.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/regular.compile.pass.cpp index 6111c2db54..6d09656a1f 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/regular.compile.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/regular.compile.pass.cpp @@ -11,7 +11,6 @@ // template // concept regular = see below; -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" @@ -22,6 +21,7 @@ #include "type_classification/moveconstructible.h" #include "type_classification/semiregular.h" +#include "test_macros.h" using cuda::std::regular; diff --git a/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/semiregular.compile.pass.cpp b/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/semiregular.compile.pass.cpp index 8941e3635f..7a1ccb45df 100644 --- a/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/semiregular.compile.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/concepts/concepts.object/semiregular.compile.pass.cpp @@ -11,7 +11,6 @@ // template // concept semiregular = see below; -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated #if defined(__clang__) #pragma clang diagnostic ignored "-Wc++17-extensions" @@ -21,6 +20,7 @@ #include #include "type_classification/semiregular.h" +#include "test_macros.h" using cuda::std::semiregular; diff --git a/libcudacxx/.upstream-tests/test/std/containers/sequences/array/array.cons/deduct.pass.cpp b/libcudacxx/.upstream-tests/test/std/containers/sequences/array/array.cons/deduct.pass.cpp index 704abc9a33..2d2bef0dc2 100644 --- a/libcudacxx/.upstream-tests/test/std/containers/sequences/array/array.cons/deduct.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/containers/sequences/array/array.cons/deduct.pass.cpp @@ -12,6 +12,7 @@ // UNSUPPORTED: libcpp-no-deduction-guides // Clang 5 will generate bad implicit deduction guides // Specifically, for the copy constructor. +// UNSUPPORTED: clang-9 && nvcc-11.1 // template diff --git a/libcudacxx/.upstream-tests/test/std/containers/views/mdspan/mdspan.extents.cons/array.pass.cpp b/libcudacxx/.upstream-tests/test/std/containers/views/mdspan/mdspan.extents.cons/array.pass.cpp index 26a0bbafa9..b094d1e11a 100644 --- a/libcudacxx/.upstream-tests/test/std/containers/views/mdspan/mdspan.extents.cons/array.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/containers/views/mdspan/mdspan.extents.cons/array.pass.cpp @@ -55,6 +55,7 @@ int main(int, char**) static_assert( is_array_cons_avail_v< cuda::std::dextents< int,2>, my_int, 2 > == true , "" ); +#if !defined(TEST_COMPILER_NVCC_BELOW_11_3) // Constraint: rank consistency static_assert( is_array_cons_avail_v< cuda::std::dextents< int,1>, int , 2 > == false, "" ); @@ -65,6 +66,7 @@ int main(int, char**) #ifndef TEST_COMPILER_NVHPC static_assert( is_array_cons_avail_v< cuda::std::dextents< int,1>, my_int_non_nothrow_constructible, 1 > == false, "" ); #endif // TEST_COMPILER_NVHPC +#endif // !defined(TEST_COMPILER_NVCC_BELOW_11_3) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/containers/views/mdspan/mdspan.extents.cons/span.pass.cpp b/libcudacxx/.upstream-tests/test/std/containers/views/mdspan/mdspan.extents.cons/span.pass.cpp index 1d4641ab2c..99601e9941 100644 --- a/libcudacxx/.upstream-tests/test/std/containers/views/mdspan/mdspan.extents.cons/span.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/containers/views/mdspan/mdspan.extents.cons/span.pass.cpp @@ -56,6 +56,7 @@ int main(int, char**) static_assert( is_span_cons_avail_v< cuda::std::dextents, my_int, 2 > == true , "" ); +#if !defined(TEST_COMPILER_NVCC_BELOW_11_3) // Constraint: rank consistency static_assert( is_span_cons_avail_v< cuda::std::dextents, int , 2 > == false, "" ); @@ -66,6 +67,7 @@ int main(int, char**) #ifndef TEST_COMPILER_NVHPC static_assert( is_span_cons_avail_v< cuda::std::dextents, my_int_non_nothrow_constructible, 1 > == false, "" ); #endif // TEST_COMPILER_NVHPC +#endif // !defined(TEST_COMPILER_NVCC_BELOW_11_3) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/data.pass.cpp b/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/data.pass.cpp index 6589f437c6..928fd36353 100644 --- a/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/data.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/data.pass.cpp @@ -71,7 +71,7 @@ void test_const_array( const T (&array)[Sz] ) assert ( cuda::std::data(array) == &array[0]); } -STATIC_TEST_GLOBAL_VAR constexpr int arrA [] { 1, 2, 3 }; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int arrA [] { 1, 2, 3 }; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/empty.pass.cpp b/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/empty.pass.cpp index ccf0950c1a..4c6c75f3aa 100644 --- a/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/empty.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/empty.pass.cpp @@ -72,7 +72,7 @@ void test_const_array( const T (&array)[Sz] ) assert (!cuda::std::empty(array)); } -STATIC_TEST_GLOBAL_VAR constexpr int arrA [] { 1, 2, 3 }; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int arrA [] { 1, 2, 3 }; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/size.pass.cpp b/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/size.pass.cpp index 8406643fc2..21551ae586 100644 --- a/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/size.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/size.pass.cpp @@ -76,7 +76,7 @@ void test_const_array( const T (&array)[Sz] ) assert ( cuda::std::size(array) == Sz ); } -STATIC_TEST_GLOBAL_VAR constexpr int arrA [] { 1, 2, 3 }; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int arrA [] { 1, 2, 3 }; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/ssize.pass.cpp b/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/ssize.pass.cpp index a25749c1c1..72decad27f 100644 --- a/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/ssize.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/iterators/iterator.container/ssize.pass.cpp @@ -85,7 +85,7 @@ void test_const_array(const T (&array)[Sz]) assert ( cuda::std::ssize(array) == Sz ); } -STATIC_TEST_GLOBAL_VAR constexpr int arrA [] { 1, 2, 3 }; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int arrA [] { 1, 2, 3 }; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/iterators/iterator.range/begin-end.pass.cpp b/libcudacxx/.upstream-tests/test/std/iterators/iterator.range/begin-end.pass.cpp index 1ee0b9ce4d..4e87a5e53c 100644 --- a/libcudacxx/.upstream-tests/test/std/iterators/iterator.range/begin-end.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/iterators/iterator.range/begin-end.pass.cpp @@ -145,10 +145,12 @@ void test_const_array( const T (&array)[Sz] ) { #endif } -STATIC_TEST_GLOBAL_VAR constexpr int global_array [] { 1, 2, 3 }; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int global_array [] { 1, 2, 3 }; #if TEST_STD_VER > 14 -STATIC_TEST_GLOBAL_VAR constexpr const int global_const_array[] = {0,1,2,3,4}; -#endif +#if !defined(TEST_COMPILER_NVCC_BELOW_11_3) +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int global_const_array[] = {0,1,2,3,4}; +#endif // nvcc > 11.2 +#endif // TEST_STD_VER > 14 int main(int, char**) { #if defined(_LIBCUDACXX_HAS_VECTOR) @@ -214,6 +216,7 @@ int main(int, char**) { static_assert ( *cuda::std::crbegin(local_const_array) == 4, "" ); } +#if !defined(TEST_COMPILER_NVCC_BELOW_11_3) { static_assert ( *cuda::std::begin(global_const_array) == 0, "" ); @@ -221,7 +224,8 @@ int main(int, char**) { static_assert ( *cuda::std::rbegin(global_const_array) == 4, "" ); static_assert ( *cuda::std::crbegin(global_const_array) == 4, "" ); } -#endif +#endif // nvcc > 11.2 +#endif // TEST_STD_VER > 14 return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/language.support/support.types/max_align_t.pass.cpp b/libcudacxx/.upstream-tests/test/std/language.support/support.types/max_align_t.pass.cpp index 90f69a7cba..7cdcc10ec6 100644 --- a/libcudacxx/.upstream-tests/test/std/language.support/support.types/max_align_t.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/language.support/support.types/max_align_t.pass.cpp @@ -11,13 +11,13 @@ // max_align_t is a trivial standard-layout type whose alignment requirement // is at least as great as that of every scalar type +#include "test_macros.h" -#ifndef __CUDACC_RTC__ +#ifndef TEST_COMPILER_NVRTC #include -#endif // __CUDACC_RTC__ -#include "test_macros.h" +#endif // TEST_COMPILER_NVRTC -#pragma nv_diag_suppress cuda_demote_unsupported_floating_point +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/ctor/ctor.inplace_init_list.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/ctor/ctor.inplace_init_list.pass.cpp index 2eb3b24300..eb4a2bb166 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/ctor/ctor.inplace_init_list.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/ctor/ctor.inplace_init_list.pass.cpp @@ -146,7 +146,9 @@ __host__ __device__ void testException() { int main(int, char**) { test(); #if defined(_LIBCUDACXX_ADDRESSOF) +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif // defined(_LIBCUDACXX_ADDRESSOF) testException(); return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/ctor/ctor.unexpect_init_list.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/ctor/ctor.unexpect_init_list.pass.cpp index e84b224c00..954d38c72a 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/ctor/ctor.unexpect_init_list.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/ctor/ctor.unexpect_init_list.pass.cpp @@ -147,7 +147,9 @@ __host__ __device__ void testException() { int main(int, char**) { test(); #if defined(_LIBCUDACXX_ADDRESSOF) +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif // defined(_LIBCUDACXX_ADDRESSOF) testException(); return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/and_then.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/and_then.pass.cpp index 7f02a8df54..08baa76955 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/and_then.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/and_then.pass.cpp @@ -368,6 +368,8 @@ constexpr bool test() { int main(int, char**) { test(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/or_else.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/or_else.pass.cpp index 7568e38bf0..8a819a5602 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/or_else.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/or_else.pass.cpp @@ -368,6 +368,8 @@ constexpr bool test() { int main(int, char**) { test(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/transform.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/transform.pass.cpp index ba2f5e902c..0edc36b3fb 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/transform.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/transform.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11 +// UNSUPPORTED: nvcc-11.1 // diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/transform_error.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/transform_error.pass.cpp index 365ab1140e..0026ce9337 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/transform_error.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.expected/monadic/transform_error.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11 +// UNSUPPORTED: nvcc-11.1 // diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/ctor/ctor.unexpect_init_list.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/ctor/ctor.unexpect_init_list.pass.cpp index 47cbcf5512..379b3fbc98 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/ctor/ctor.unexpect_init_list.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/ctor/ctor.unexpect_init_list.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11 +// UNSUPPORTED: nvcc-11.1 // Older Clangs do not support the C++20 feature to constrain destructors // template diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/and_then.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/and_then.pass.cpp index f42fa4ee45..8642515ef7 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/and_then.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/and_then.pass.cpp @@ -258,6 +258,8 @@ constexpr bool test() { int main(int, char**) { test(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/or_else.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/or_else.pass.cpp index f1586e6e01..0155b0b126 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/or_else.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/or_else.pass.cpp @@ -355,6 +355,8 @@ constexpr bool test() { int main(int, char**) { test(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/transform.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/transform.pass.cpp index 6c351abf60..a19c969a86 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/transform.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/transform.pass.cpp @@ -213,6 +213,8 @@ constexpr bool test() { int main(int, char**) { test(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/transform_error.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/transform_error.pass.cpp index ba6a4839d2..87d4548937 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/transform_error.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/monadic/transform_error.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11 +// UNSUPPORTED: nvcc-11.1 // diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/observers/deref.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/observers/deref.pass.cpp index 26cded7746..296f59c4bd 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/observers/deref.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/observers/deref.pass.cpp @@ -40,6 +40,8 @@ __host__ __device__ constexpr bool test() { int main(int, char**) { test(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/observers/value.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/observers/value.pass.cpp index d44dce123b..e7b7b1970d 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/observers/value.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/expected/expected.void/observers/value.pass.cpp @@ -83,7 +83,9 @@ __host__ __device__ void testException() { int main(int, char**) { test(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) testException(); return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.bind_front/bind_front.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.bind_front/bind_front.pass.cpp index 97a9aa795f..b2d0467614 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.bind_front/bind_front.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.bind_front/bind_front.pass.cpp @@ -9,6 +9,7 @@ // UNSUPPORTED: c++03, c++11, c++14 // UNSUPPORTED: gcc-6 +// UNSUPPORTED: nvcc-11.1 // functional diff --git a/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp index 6d2f12e5b3..b58deac92b 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp @@ -45,10 +45,10 @@ #include // for cuda::std::move #include -#pragma nv_diag_suppress set_but_not_used - #include "test_macros.h" +TEST_NV_DIAG_SUPPRESS(set_but_not_used) + struct NonCopyable { __host__ __device__ NonCopyable() {} diff --git a/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp index 5f3bda0bb4..5a53a85db6 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp @@ -8,6 +8,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: gcc-6 +// UNSUPPORTED: nvcc-11.1 // TODO: there's multiple failures that appear to be all about overload resolution and SFINAE, // and they will require further debugging to pinpoint the root cause of (almost certainly a @@ -23,7 +24,7 @@ #include "test_macros.h" // #include "type_id.h" -#pragma nv_diag_suppress set_but_not_used +TEST_NV_DIAG_SUPPRESS(set_but_not_used) /////////////////////////////////////////////////////////////////////////////// // CALLABLE TEST TYPES diff --git a/libcudacxx/.upstream-tests/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp index 538d4f1aa3..d1d9af56e5 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp @@ -31,15 +31,15 @@ struct A int n; }; -__device__ constexpr int global_integer = 0; +constexpr int global_integer = 0; static_assert(cuda::std::addressof(global_integer) == &global_integer, ""); -__device__ constexpr double global_double = 0.0; +constexpr double global_double = 0.0; static_assert(cuda::std::addressof(global_double) == &global_double, ""); #ifndef __CUDA_ARCH__ // fails in __cudaRegisterVariable -__device__ constexpr A global_struct{}; -__device__ constexpr const A* address = cuda::std::addressof(global_struct); +constexpr A global_struct{}; +constexpr const A* address = cuda::std::addressof(global_struct); static_assert(&(address->n) == &(global_struct.n), ""); #endif #endif diff --git a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp index 2240544994..58d2fe9f1c 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp @@ -9,8 +9,6 @@ // type_traits // is_convertible -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated - #include #include "test_macros.h" diff --git a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp index c2eecdbd93..d66353b059 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp @@ -18,13 +18,13 @@ #define _LIBCUDACXX_ENABLE_CXX20_REMOVED_TYPE_TRAITS #define _LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS -#pragma nv_diag_suppress 3013 // a volatile function parameter is deprecated - #include // #include // #include #include "test_macros.h" +TEST_NV_DIAG_SUPPRESS(3013) // a volatile function parameter is deprecated + struct wat { __host__ __device__ diff --git a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp index b02cb531c1..636fa33f03 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp @@ -13,7 +13,7 @@ #include #include "test_macros.h" -#pragma nv_diag_suppress cuda_demote_unsupported_floating_point +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) template __host__ __device__ diff --git a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp index aca96ecb65..a94510b8de 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp @@ -14,7 +14,7 @@ #include // for cuda::std::nullptr_t #include "test_macros.h" -#pragma nv_diag_suppress cuda_demote_unsupported_floating_point +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) template __host__ __device__ diff --git a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp index dc48d2438c..3e5b5be0c5 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp @@ -14,7 +14,7 @@ #include "test_macros.h" -#pragma nv_diag_suppress cuda_demote_unsupported_floating_point +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) template __host__ __device__ diff --git a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp index 1598fd9d03..5cc9be50d7 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp @@ -14,7 +14,7 @@ #include // for cuda::std::nullptr_t #include "test_macros.h" -#pragma nv_diag_suppress cuda_demote_unsupported_floating_point +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) template __host__ __device__ diff --git a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp index 290e36ce45..416e4e75f6 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -24,7 +24,7 @@ #define LIBCPP11_STATIC_ASSERT(...) ((void)0) #endif -#pragma nv_diag_suppress declared_but_not_referenced +TEST_NV_DIAG_SUPPRESS(declared_but_not_referenced) struct A { diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp index ac48e29a8c..de290abe36 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp @@ -39,9 +39,9 @@ constexpr bool test() { typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + O o1; // disengaged + O o2{1}; // engaged + O o3{val}; // engaged assert(!(o1 == T(1))); assert((o2 == T(1))); @@ -57,13 +57,13 @@ constexpr bool test() { } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 == 42l); assert(!(101l == o1)); } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 == 42); assert(!(101 == o1)); } @@ -74,7 +74,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp index 275f110170..52c3b6aa91 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp @@ -37,9 +37,9 @@ constexpr bool test() { typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + O o1; // disengaged + O o2{1}; // engaged + O o3{val}; // engaged assert(!(o1 > T(1))); assert(!(o2 > T(1))); // equal @@ -57,13 +57,13 @@ constexpr bool test() { } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 > 11l); assert(!(42l > o1)); } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 > 11); assert(!(42 > o1)); } @@ -74,7 +74,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp index 365f44c4c3..29e43eaa86 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp @@ -39,9 +39,9 @@ constexpr bool test() { typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + O o1; // disengaged + O o2{1}; // engaged + O o3{val}; // engaged assert(!(o1 >= T(1))); assert((o2 >= T(1))); // equal @@ -59,13 +59,13 @@ constexpr bool test() { } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 >= 42l); assert(!(11l >= o1)); } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 >= 42); assert(!(11 >= o1)); } @@ -76,7 +76,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp index 30791817cf..c78a600756 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp @@ -39,9 +39,9 @@ constexpr bool test() { typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + O o1; // disengaged + O o2{1}; // engaged + O o3{val}; // engaged assert((o1 <= T(1))); assert((o2 <= T(1))); // equal @@ -59,13 +59,13 @@ constexpr bool test() { } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 <= 42l); assert(!(101l <= o1)); } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 <= 42); assert(!(101 <= o1)); } @@ -76,7 +76,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp index 54acf3988f..b1a1d3cc2a 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp @@ -37,9 +37,9 @@ constexpr bool test() { typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + O o1; // disengaged + O o2{1}; // engaged + O o3{val}; // engaged assert((o1 < T(1))); assert(!(o2 < T(1))); // equal @@ -57,13 +57,13 @@ constexpr bool test() { } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 < 101l); assert(!(42l < o1)); } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 < 101); assert(!(42 < o1)); } @@ -74,7 +74,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp index cb1a07e230..56caca5f29 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp @@ -39,9 +39,9 @@ constexpr bool test() { typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + O o1; // disengaged + O o2{1}; // engaged + O o3{val}; // engaged assert((o1 != T(1))); assert(!(o2 != T(1))); @@ -57,13 +57,13 @@ constexpr bool test() { } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 != 101l); assert(!(42l != o1)); } { using O = optional; - constexpr O o1(42); + O o1(42); assert(o1 != 101); assert(!(42 != o1)); } @@ -74,7 +74,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.monadic/or_else.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.monadic/or_else.pass.cpp index 869aab07a1..070e24db4c 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.monadic/or_else.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.monadic/or_else.pass.cpp @@ -128,14 +128,16 @@ TEST_CONSTEXPR_CXX17 bool test_nontrivial() { int main(int, char**) { test(); test_nontrivial(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) // GCC <9 incorrectly trips on the assertions in this, so disable it there #if TEST_STD_VER > 14 && (!defined(TEST_COMPILER_GCC) || __GNUC__ < 9) static_assert(test(), ""); -#endif +#endif // TEST_STD_VER > 14 && (!defined(TEST_COMPILER_GCC) || __GNUC__ < 9) #if TEST_STD_VER > 17 #if defined(_LIBCUDACXX_ADDRESSOF) static_assert(test_nontrivial()); -#endif -#endif +#endif // defined(_LIBCUDACXX_ADDRESSOF) +#endif // TEST_STD_VER > 17 +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/equal.pass.cpp index 1ceea1d722..4271f311f5 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/equal.pass.cpp @@ -28,8 +28,8 @@ constexpr bool test() { typedef int T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged + O o1; // disengaged + O o2{1}; // engaged assert( (nullopt == o1)); assert(!(nullopt == o2)); @@ -46,7 +46,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/greater.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/greater.pass.cpp index 00a736e750..79993322bf 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/greater.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/greater.pass.cpp @@ -28,8 +28,8 @@ constexpr bool test() { typedef int T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged + O o1; // disengaged + O o2{1}; // engaged assert(!(nullopt > o1)); assert(!(nullopt > o2)); @@ -46,7 +46,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp index e6a09e5104..35ede59642 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp @@ -28,8 +28,8 @@ constexpr bool test() { typedef int T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged + O o1; // disengaged + O o2{1}; // engaged assert( (nullopt >= o1)); assert(!(nullopt >= o2)); @@ -46,7 +46,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/less_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/less_equal.pass.cpp index 0e6eead236..1b7ebc25d7 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/less_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/less_equal.pass.cpp @@ -29,8 +29,8 @@ constexpr bool test() { typedef int T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged + O o1; // disengaged + O o2{1}; // engaged assert( (nullopt <= o1)); assert( (nullopt <= o2)); @@ -47,7 +47,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/less_than.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/less_than.pass.cpp index 5d8c604f25..c5ffec46a2 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/less_than.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/less_than.pass.cpp @@ -28,8 +28,8 @@ constexpr bool test() { typedef int T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged + O o1; // disengaged + O o2{1}; // engaged assert(!(nullopt < o1)); assert( (nullopt < o2)); @@ -46,7 +46,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/not_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/not_equal.pass.cpp index 3192c734cd..efc6efab0c 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/not_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.nullops/not_equal.pass.cpp @@ -28,8 +28,8 @@ constexpr bool test() { typedef int T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged + O o1; // disengaged + O o2{1}; // engaged assert(!(nullopt != o1)); assert( (nullopt != o2)); @@ -46,7 +46,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp index 48647ca862..1f644ad96b 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp @@ -315,7 +315,9 @@ int main(int, char**) test_throws(); #if !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(pr38638(3) == 5, ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif // !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp index 09db63062e..29070c130f 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp @@ -203,6 +203,7 @@ int main(int, char**) { test_with_test_type(); test_ambiguous_assign(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { optional opt; constexpr optional opt2; @@ -235,6 +236,7 @@ int main(int, char**) assert(static_cast(opt) == static_cast(opt2)); assert(*opt == *opt2); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #ifndef TEST_HAS_NO_EXCEPTIONS { optional opt; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp index fba4f525ea..0ff8adbff7 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp @@ -59,8 +59,10 @@ int main(int, char**) { using O = optional; #if !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(assign_empty(O{42}), ""); static_assert(assign_value(O{42}), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif // !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 assert(assign_empty(O{42})); assert(assign_value(O{42})); @@ -68,8 +70,10 @@ int main(int, char**) { using O = optional; #if !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(assign_empty(O{42}), ""); static_assert(assign_value(O{42}), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif // !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 assert(assign_empty(O{42})); assert(assign_value(O{42})); diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp index 653e5eee2f..21547b45dc 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp @@ -77,6 +77,7 @@ int main(int, char**) static_assert(static_cast(opt2) == false, ""); assert(static_cast(opt) == static_cast(opt2)); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { optional opt; constexpr optional opt2(2); @@ -86,6 +87,7 @@ int main(int, char**) assert(static_cast(opt) == static_cast(opt2)); assert(*opt == *opt2); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { optional opt(3); constexpr optional opt2; @@ -104,6 +106,7 @@ int main(int, char**) assert(static_cast(opt2) == false); assert(static_cast(opt) == static_cast(opt2)); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { optional opt(3); constexpr optional opt2(2); @@ -113,11 +116,14 @@ int main(int, char**) assert(static_cast(opt) == static_cast(opt2)); assert(*opt == *opt2); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { using O = optional; #if !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(assign_empty(O{42}), ""); static_assert(assign_value(O{42}), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif // !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 assert(assign_empty(O{42})); assert(assign_value(O{42})); @@ -125,8 +131,10 @@ int main(int, char**) { using O = optional; #if !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(assign_empty(O{42}), ""); static_assert(assign_value(O{42}), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif // !defined(TEST_COMPILER_GCC) || __GNUC__ > 6 assert(assign_empty(O{42})); assert(assign_value(O{42})); diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp index e8705f6901..7db5eb9cf2 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp @@ -74,21 +74,25 @@ constexpr bool explicit_conversion(Input&& in, const Expect& v) __host__ __device__ void test_implicit() { +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { static_assert(implicit_conversion(42, 42), ""); } { static_assert(implicit_conversion(3.14, 3.14), ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { int x = 42; optional o(&x); assert(*o == &x); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { using T = TrivialTestTypes::TestType; static_assert(implicit_conversion(42, 42), ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { using T = TestTypes::TestType; assert(implicit_conversion(3, T(3))); @@ -117,6 +121,7 @@ void test_implicit() __host__ __device__ void test_explicit() { +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { using T = ExplicitTrivialTestTypes::TestType; static_assert(explicit_conversion(42, 42), ""); @@ -126,6 +131,7 @@ void test_explicit() { static_assert(explicit_conversion(42, 42), ""); static_assert(!cuda::std::is_convertible::value, ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { using T = ExplicitTestTypes::TestType; T::reset(); diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp index 3f9140a962..d2413b361a 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp @@ -27,6 +27,7 @@ using cuda::std::optional; int main(int, char**) { +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { typedef int T; constexpr T t(5); @@ -57,6 +58,7 @@ int main(int, char**) }; } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { const int x = 42; optional o(x); @@ -83,6 +85,7 @@ int main(int, char**) assert(static_cast(opt) == true); assert(opt.value().value == 3); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { typedef ConstexprTestTypes::TestType T; constexpr T t(3); @@ -113,6 +116,7 @@ int main(int, char**) }; } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #ifndef TEST_HAS_NO_EXCEPTIONS { struct Z { diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp index 4ffadf909a..7259003b33 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp @@ -123,8 +123,10 @@ int main(int, char**) { test(); test(3); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(constexpr_test(), "" ); static_assert(constexpr_test(3), "" ); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { const optional o(42); @@ -170,11 +172,13 @@ int main(int, char**) { test_reference_extension(); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr cuda::std::optional o1{4}; constexpr cuda::std::optional o2 = o1; static_assert( *o2 == 4, "" ); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/default.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/default.pass.cpp index 49481d94e2..a4236c45a7 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/default.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/default.pass.cpp @@ -23,15 +23,14 @@ using cuda::std::optional; template __host__ __device__ -void -test_constexpr() +constexpr bool test_constexpr() { static_assert(cuda::std::is_nothrow_default_constructible::value, ""); static_assert(cuda::std::is_trivially_destructible::value, ""); static_assert(cuda::std::is_trivially_destructible::value, ""); - constexpr Opt opt; - static_assert(static_cast(opt) == false, ""); + Opt opt; + assert(static_cast(opt) == false); struct test_constexpr_ctor : public Opt @@ -39,12 +38,13 @@ test_constexpr() __host__ __device__ constexpr test_constexpr_ctor() {} }; + + return true; } template __host__ __device__ -void -test() +constexpr bool test() { static_assert(cuda::std::is_nothrow_default_constructible::value, ""); static_assert(!cuda::std::is_trivially_destructible::value, ""); @@ -64,6 +64,8 @@ test() __host__ __device__ constexpr test_constexpr_ctor() {} }; + + return true; } int main(int, char**) @@ -76,14 +78,16 @@ int main(int, char**) test_constexpr>(); #endif test>(); - // EXTENSIONS -#if defined(_LIBCPP_VERSION) && 0 // FIXME these extensions are currently disabled. - test_constexpr>(); - test_constexpr>(); - test_constexpr>(); - test_constexpr>(); - test_constexpr>(); + +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) + static_assert(test_constexpr>(), ""); + static_assert(test_constexpr>(), ""); +#if !defined(TEST_COMPILER_C1XX) || TEST_STD_VER >= 17 + static_assert(test_constexpr>(), ""); + static_assert(test_constexpr>(), ""); + static_assert(test_constexpr>(), ""); #endif +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp index 5be57d6559..a7a0e4cc76 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp @@ -71,6 +71,7 @@ class Z int main(int, char**) { +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(in_place, 5); static_assert(static_cast(opt) == true, ""); @@ -85,6 +86,7 @@ int main(int, char**) }; } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { optional opt(in_place, 5); assert(*opt == 5); @@ -104,6 +106,7 @@ int main(int, char**) assert(static_cast(opt) == true); assert(*opt == X(5, 4)); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(in_place); static_assert(static_cast(opt) == true, ""); @@ -146,6 +149,7 @@ int main(int, char**) }; } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #ifndef TEST_HAS_NO_EXCEPTIONS { try diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp index 8cef29ac39..91bb8b23fe 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp @@ -110,11 +110,13 @@ int main(int, char**) assert(static_cast(opt) == true); assert((*opt == Y{3, 1})); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(in_place, {3, 1}); static_assert(static_cast(opt) == true, ""); static_assert(*opt == Y{3, 1}, ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) struct test_constexpr_ctor : public optional diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp index 0952833737..9d69163cfb 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp @@ -156,8 +156,10 @@ int main(int, char**) { test(); test(3); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(constexpr_test(), "" ); static_assert(constexpr_test(3), "" ); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { optional o(42); @@ -227,11 +229,13 @@ int main(int, char**) { test_reference_extension(); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr cuda::std::optional o1{4}; constexpr cuda::std::optional o2 = cuda::std::move(o1); static_assert( *o2 == 4, "" ); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp index a1c185c73c..7df33a24ad 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp @@ -26,15 +26,15 @@ using cuda::std::nullopt; template __host__ __device__ -void +constexpr bool test_constexpr() { static_assert(cuda::std::is_nothrow_constructible::value, ""); static_assert(cuda::std::is_trivially_destructible::value, ""); static_assert(cuda::std::is_trivially_destructible::value, ""); - constexpr Opt opt(nullopt); - static_assert(static_cast(opt) == false, ""); + Opt opt(nullopt); + assert(static_cast(opt) == false); struct test_constexpr_ctor : public Opt @@ -42,6 +42,8 @@ test_constexpr() __host__ __device__ constexpr test_constexpr_ctor() {} }; + + return true; } template @@ -79,5 +81,15 @@ int main(int, char**) #endif test>(); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) + static_assert(test_constexpr>(), ""); + static_assert(test_constexpr>(), ""); +#if !defined(TEST_COMPILER_C1XX) || TEST_STD_VER >= 17 + static_assert(test_constexpr>(), ""); + static_assert(test_constexpr>(), ""); + static_assert(test_constexpr>(), ""); +#endif +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) + return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp index 266eac6784..56cd287e05 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp @@ -39,6 +39,7 @@ class Z int main(int, char**) { +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { typedef int T; constexpr optional opt(T(5)); @@ -65,6 +66,7 @@ int main(int, char**) constexpr test_constexpr_ctor(T&&) {} }; } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { const int x = 42; optional o(cuda::std::move(x)); @@ -100,6 +102,7 @@ int main(int, char**) assert(static_cast(opt) == true); assert(opt.value().value == 3); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { typedef ConstexprTestTypes::TestType T; constexpr optional opt = {T(3)}; @@ -141,6 +144,7 @@ int main(int, char**) }; } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #ifndef TEST_HAS_NO_EXCEPTIONS { try diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/bool.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/bool.pass.cpp index 94b59e0dbb..39f8f833dd 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/bool.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/bool.pass.cpp @@ -26,6 +26,7 @@ int main(int, char**) ASSERT_NOEXCEPT(bool(opt)); static_assert(!cuda::std::is_convertible, bool>::value, ""); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt; static_assert(!opt, ""); @@ -34,6 +35,7 @@ int main(int, char**) constexpr optional opt(0); static_assert(opt, ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp index 8937654a49..6eee861ef2 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp @@ -65,7 +65,9 @@ int main(int, char**) optional opt(X{}); assert((*opt).test() == 4); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test() == 7, ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp index 7efe9ebbc9..3d4724cbec 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp @@ -53,6 +53,7 @@ int main(int, char**) // Regardless this function should still be noexcept(false) because // it has a narrow contract. } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(X{}); static_assert((*opt).test() == 3, ""); @@ -61,6 +62,7 @@ int main(int, char**) constexpr optional opt(Y{}); assert((*opt).test() == 2); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp index e65b2a3f27..c70e2dccbf 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp @@ -53,6 +53,7 @@ int main(int, char**) // Regardless this function should still be noexcept(false) because // it has a narrow contract. } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(X{}); static_assert((*cuda::std::move(opt)).test() == 5, ""); @@ -61,6 +62,7 @@ int main(int, char**) constexpr optional opt(Y{}); assert((*cuda::std::move(opt)).test() == 2); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp index 8d7d40d724..6ab9f9ee0b 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp @@ -65,7 +65,9 @@ int main(int, char**) optional opt(X{}); assert((*cuda::std::move(opt)).test() == 6); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test() == 7, ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/has_value.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/has_value.pass.cpp index bfcbad52c7..31883e76ee 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/has_value.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/has_value.pass.cpp @@ -34,6 +34,7 @@ int main(int, char**) optional opt(0); assert(opt.has_value()); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt; static_assert(!opt.has_value(), ""); @@ -42,6 +43,7 @@ int main(int, char**) constexpr optional opt(0); static_assert(opt.has_value(), ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp index 15c1f45a81..eac5585bf2 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp @@ -60,7 +60,9 @@ int main(int, char**) } { #if defined(_LIBCUDACXX_ADDRESSOF) +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test() == 3, ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp index af24cdb84d..f64adbada8 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp @@ -54,6 +54,7 @@ int main(int, char**) // Regardless this function should still be noexcept(false) because // it has a narrow contract. } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(X{}); #if defined(_LIBCUDACXX_ADDRESSOF) @@ -74,6 +75,7 @@ int main(int, char**) unused(opt); #endif } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp index 638922075e..6994345e68 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp @@ -83,7 +83,9 @@ int main(int, char**) } #endif assert(test() == 7); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test() == 7, ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp index a7f32dbc8e..aca19151a5 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp @@ -50,10 +50,12 @@ int main(int, char**) ASSERT_NOT_NOEXCEPT(opt.value()); ASSERT_SAME_TYPE(decltype(opt.value()), X const&); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(in_place); static_assert(opt.value().test() == 3, ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { const optional opt(in_place); assert(opt.value().test() == 3); diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp index 9636222440..9ed04ed79f 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp @@ -50,10 +50,12 @@ int main(int, char**) ASSERT_NOT_NOEXCEPT(cuda::std::move(opt).value()); ASSERT_SAME_TYPE(decltype(cuda::std::move(opt).value()), X const&&); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(in_place); static_assert(cuda::std::move(opt).value().test() == 5, ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { const optional opt(in_place); assert(cuda::std::move(opt).value().test() == 5); diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_or_const.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_or_const.pass.cpp index 98d21aa478..a4ea849096 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_or_const.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_or_const.pass.cpp @@ -45,6 +45,7 @@ struct X int main(int, char**) { +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr optional opt(2); constexpr Y y(3); @@ -63,6 +64,7 @@ int main(int, char**) constexpr optional opt; static_assert(opt.value_or(Y(3)) == 4, ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { const optional opt(2); const Y y(3); diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp index 11e703588d..40f901ed51 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp @@ -81,7 +81,9 @@ int main(int, char**) } #endif assert(test() == 7); +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test() == 7, ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) return 0; } diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/equal.pass.cpp index 8386c1df6c..b724b11a42 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/equal.pass.cpp @@ -38,11 +38,11 @@ constexpr bool test() { typedef X T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + O o1; // disengaged + O o2; // disengaged + O o3{1}; // engaged + O o4{2}; // engaged + O o5{1}; // engaged assert(o1 == o1); assert(o1 == o2); @@ -77,14 +77,14 @@ constexpr bool test() { { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 == O2(42)); assert(!(O2(101) == o1)); } { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 == O2(42)); assert(!(O2(101) == o1)); } @@ -95,7 +95,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp index ff7bad4ba8..b556d22eca 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp @@ -36,11 +36,11 @@ constexpr bool test() { { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + O o1; // disengaged + O o2; // disengaged + O o3{1}; // engaged + O o4{2}; // engaged + O o5{1}; // engaged assert((o1 >= o1)); assert((o1 >= o2)); @@ -75,14 +75,14 @@ constexpr bool test() { { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 >= O2(42)); assert(!(O2(11) >= o1)); } { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 >= O2(42)); assert(!(O2(1) >= o1)); } @@ -93,7 +93,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/greater_than.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/greater_than.pass.cpp index c82d674bad..f04a52bafd 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/greater_than.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/greater_than.pass.cpp @@ -34,11 +34,11 @@ constexpr bool test() { { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + O o1; // disengaged + O o2; // disengaged + O o3{1}; // engaged + O o4{2}; // engaged + O o5{1}; // engaged assert(!(o1 > o1)); assert(!(o1 > o2)); @@ -73,14 +73,14 @@ constexpr bool test() { { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 > O2(1)); assert(!(O2(42) > o1)); } { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 > O2(1)); assert(!(O2(42) > o1)); } @@ -91,7 +91,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/less_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/less_equal.pass.cpp index 907ddbf40d..0591b859c5 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/less_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/less_equal.pass.cpp @@ -36,11 +36,11 @@ constexpr bool test() { { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + O o1; // disengaged + O o2; // disengaged + O o3{1}; // engaged + O o4{2}; // engaged + O o5{1}; // engaged assert((o1 <= o1)); assert((o1 <= o2)); @@ -75,14 +75,14 @@ constexpr bool test() { { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 <= O2(42)); assert(!(O2(101) <= o1)); } { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 <= O2(42)); assert(!(O2(101) <= o1)); } @@ -93,7 +93,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/less_than.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/less_than.pass.cpp index 9d7141299f..234951577a 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/less_than.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/less_than.pass.cpp @@ -34,11 +34,11 @@ constexpr bool test() { { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + O o1; // disengaged + O o2; // disengaged + O o3{1}; // engaged + O o4{2}; // engaged + O o5{1}; // engaged assert(!(o1 < o1)); assert(!(o1 < o2)); @@ -73,14 +73,14 @@ constexpr bool test() { { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 < O2(101)); assert(!(O2(101) < o1)); } { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 < O2(101)); assert(!(O2(101) < o1)); } @@ -91,7 +91,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/not_equal.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/not_equal.pass.cpp index 0c0980bf42..f76baaec0f 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/not_equal.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.relops/not_equal.pass.cpp @@ -38,11 +38,11 @@ constexpr bool test() { typedef X T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + O o1; // disengaged + O o2; // disengaged + O o3{1}; // engaged + O o4{2}; // engaged + O o5{1}; // engaged assert(!(o1 != o1)); assert(!(o1 != o2)); @@ -77,14 +77,14 @@ constexpr bool test() { { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 != O2(101)); assert(!(O2(42) != o1)); } { using O1 = optional; using O2 = optional; - constexpr O1 o1(42); + O1 o1(42); assert(o1 != O2(101)); assert(!(O2(42) != o1)); } @@ -96,7 +96,9 @@ constexpr bool test() { int main(int, char**) { test(); #if TEST_STD_VER >= 17 +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test()); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif return 0; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp index 161f4998ce..7ea96be4b4 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp @@ -38,11 +38,13 @@ int main(int, char**) ASSERT_SAME_TYPE(decltype(opt), cuda::std::optional); assert(*opt == arr); } +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr auto opt = cuda::std::make_optional(2); ASSERT_SAME_TYPE(decltype(opt), const cuda::std::optional); static_assert(opt.value() == 2, ""); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { auto opt = cuda::std::make_optional(2); ASSERT_SAME_TYPE(decltype(opt), cuda::std::optional); diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp index e7d1c56fa6..800f07912b 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp @@ -28,11 +28,13 @@ int main(int, char**) { +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) { constexpr auto opt = cuda::std::make_optional('a'); static_assert(*opt == int('a'), ""); assert(*opt == int('a')); } +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #ifdef _LIBCUDACXX_HAS_STRING { cuda::std::string s = "123"; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp index 90d08d858a..c7b43f04fd 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp @@ -57,7 +57,9 @@ int main(int, char**) { test(); #if defined(_LIBCUDACXX_ADDRESSOF) +#if !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) static_assert(test(), ""); +#endif // !(defined(TEST_COMPILER_NVCC_BELOW_11_3) && defined(TEST_COMPILER_CLANG)) #endif /* { diff --git a/libcudacxx/.upstream-tests/test/std/utilities/time/date.time/ctime.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/time/date.time/ctime.pass.cpp index dedb0fb706..89c9c4efe8 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/time/date.time/ctime.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/time/date.time/ctime.pass.cpp @@ -31,7 +31,7 @@ #pragma GCC diagnostic ignored "-Wformat-zero-length" #endif -#pragma nv_diag_suppress set_but_not_used +TEST_NV_DIAG_SUPPRESS(set_but_not_used) int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/utilities/time/time.cal/euclidian.h b/libcudacxx/.upstream-tests/test/std/utilities/time/time.cal/euclidian.h index 9233a04892..e4a4b4f320 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/time/time.cal/euclidian.h +++ b/libcudacxx/.upstream-tests/test/std/utilities/time/time.cal/euclidian.h @@ -6,10 +6,11 @@ // //===----------------------------------------------------------------------===// -#pragma nv_diag_suppress 186 - #include +#include "test_macros.h" + +TEST_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero // Assumption: minValue < maxValue // Assumption: minValue <= rhs <= maxValue diff --git a/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp index 71f33748ee..1f5665795c 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" -#pragma nv_diag_suppress set_but_not_used +TEST_NV_DIAG_SUPPRESS(set_but_not_used) int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp index 70e0222533..9146ac4de6 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" -#pragma nv_diag_suppress set_but_not_used +TEST_NV_DIAG_SUPPRESS(set_but_not_used) int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.literals/literals.abiv3.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.literals/literals.abiv3.pass.cpp index 06047b8168..4013c0fec5 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.literals/literals.abiv3.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.literals/literals.abiv3.pass.cpp @@ -9,9 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 // -#pragma nv_diag_suppress declared_but_not_referenced -#pragma nv_diag_suppress set_but_not_used - #define _LIBCUDACXX_CUDA_ABI_VERSION 3 #include @@ -20,6 +17,10 @@ #include "test_macros.h" +TEST_NV_DIAG_SUPPRESS(declared_but_not_referenced) +TEST_NV_DIAG_SUPPRESS(set_but_not_used) +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) + int main(int, char**) { using namespace cuda::std::literals::chrono_literals; diff --git a/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp index ec33082168..f207b5ce87 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp @@ -19,6 +19,9 @@ #include #include "test_macros.h" + +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) + #include "truncate_fp.h" int main(int, char**) diff --git a/libcudacxx/.upstream-tests/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp b/libcudacxx/.upstream-tests/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp index ff21060616..1abf8d95c8 100644 --- a/libcudacxx/.upstream-tests/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp @@ -15,6 +15,8 @@ #include "test_macros.h" +TEST_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) + template __host__ __device__ void diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.cons/assign.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.cons/assign.pass.cpp index ffe6a84d02..b022ee7040 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.cons/assign.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.cons/assign.pass.cpp @@ -33,9 +33,9 @@ constexpr bool doAssign(T lhs, T rhs) struct A{}; -__device__ constexpr int carr1[] = {1,2,3,4}; -__device__ constexpr int carr2[] = {3,4,5}; -__device__ constexpr int carr3[] = {7,8}; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int carr1[] = {1,2,3,4}; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int carr2[] = {3,4,5}; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int carr3[] = {7,8}; __device__ int arr[] = {5,6,7,9}; int main(int, char**) diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.cons/copy.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.cons/copy.pass.cpp index 719a1d139b..bee49598cd 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.cons/copy.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.cons/copy.pass.cpp @@ -42,7 +42,7 @@ void testCV () assert((doCopy(cuda::std::span(&arr[0], 2)))); } -__device__ constexpr int carr[] = {1,2,3}; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int carr[] = {1,2,3}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/back.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/back.pass.cpp index a785b85441..95bcf45e3a 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/back.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/back.pass.cpp @@ -46,8 +46,8 @@ void testEmptySpan(Span sp) } struct A{}; -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/data.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/data.pass.cpp index 01b5045cf7..699165a600 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/data.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/data.pass.cpp @@ -37,8 +37,8 @@ void testRuntimeSpan(Span sp, typename Span::pointer ptr) } struct A{}; -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/front.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/front.pass.cpp index abf009581d..6840d8eaa0 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/front.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/front.pass.cpp @@ -47,8 +47,8 @@ void testEmptySpan(Span sp) } struct A{}; -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/op_idx.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/op_idx.pass.cpp index 7c32f0ccaf..95deffe699 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/op_idx.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.elem/op_idx.pass.cpp @@ -43,8 +43,8 @@ void testRuntimeSpan(Span sp, size_t idx) } struct A{}; -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/begin.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/begin.pass.cpp index 6fc9d571b0..fb32eec5ee 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/begin.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/begin.pass.cpp @@ -57,8 +57,8 @@ void testRuntimeSpan(Span s) struct A{}; __host__ __device__ bool operator==(A, A) {return true;} -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/end.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/end.pass.cpp index 84964871e8..8612d353b5 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/end.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/end.pass.cpp @@ -61,8 +61,8 @@ void testRuntimeSpan(Span s) struct A{}; __host__ __device__ bool operator==(A, A) {return true;} -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/rbegin.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/rbegin.pass.cpp index 8cd8f1d38f..308a2effa0 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/rbegin.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/rbegin.pass.cpp @@ -59,9 +59,9 @@ struct A{}; __host__ __device__ bool operator==(A, A) {return true;} #if TEST_STD_VER > 14 -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; #endif -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/rend.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/rend.pass.cpp index 87de726a39..70a50e45c6 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/rend.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.iterators/rend.pass.cpp @@ -58,9 +58,9 @@ struct A{}; __host__ __device__ bool operator==(A, A) {return true;} #if TEST_STD_VER > 14 -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; #endif -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.objectrep/as_writable_bytes.verify.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.objectrep/as_writable_bytes.verify.cpp index 23dedf4cb5..e01500475d 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.objectrep/as_writable_bytes.verify.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.objectrep/as_writable_bytes.verify.cpp @@ -22,7 +22,7 @@ #include "test_macros.h" -__device__ constexpr int iArr2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int iArr2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; struct A {}; diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/empty.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/empty.pass.cpp index caeb42305b..5d68cbcec5 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/empty.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/empty.pass.cpp @@ -20,8 +20,8 @@ #include "test_macros.h" struct A{}; -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/size.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/size.pass.cpp index e9386d37a3..b7e8ee0d83 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/size.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/size.pass.cpp @@ -37,8 +37,8 @@ void testRuntimeSpan(Span sp, size_t sz) } struct A{}; -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/size_bytes.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/size_bytes.pass.cpp index 92c3f3778f..2d44b0376b 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/size_bytes.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.obs/size_bytes.pass.cpp @@ -38,8 +38,8 @@ void testRuntimeSpan(Span sp, size_t sz) } struct A{}; -__device__ constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; -__device__ int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; +constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +STATIC_TEST_GLOBAL_VAR int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main(int, char**) { diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/first.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/first.pass.cpp index 16c3a5133a..5536987490 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/first.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/first.pass.cpp @@ -61,7 +61,7 @@ void testRuntimeSpan(Span sp) assert(s1.size() == s2.size()); } -__device__ constexpr int carr1[] = {1,2,3,4}; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int carr1[] = {1,2,3,4}; __device__ int arr[] = {5,6,7}; int main(int, char**) diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/last.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/last.pass.cpp index 824c75773e..b07c3d4336 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/last.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/last.pass.cpp @@ -60,7 +60,7 @@ void testRuntimeSpan(Span sp) assert(s1.size() == s2.size()); } -__device__ constexpr int carr1[] = {1,2,3,4}; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int carr1[] = {1,2,3,4}; __device__ int arr[] = {5,6,7}; int main(int, char**) diff --git a/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/subspan.pass.cpp b/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/subspan.pass.cpp index c3e1eca480..e92bdebef9 100644 --- a/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/subspan.pass.cpp +++ b/libcudacxx/.upstream-tests/test/std/views/views.span/span.sub/subspan.pass.cpp @@ -100,7 +100,7 @@ void testRuntimeSpan(Span sp) assert(s1.size() == s2.size()); } -__device__ constexpr int carr1[] = {1,2,3,4}; +STATIC_TEST_GLOBAL_VAR TEST_CONSTEXPR_GLOBAL int carr1[] = {1,2,3,4}; __device__ int arr1[] = {5,6,7}; int main(int, char**) diff --git a/libcudacxx/.upstream-tests/test/support/test_macros.h b/libcudacxx/.upstream-tests/test/support/test_macros.h index b643d28562..8de26eda5d 100644 --- a/libcudacxx/.upstream-tests/test/support/test_macros.h +++ b/libcudacxx/.upstream-tests/test/support/test_macros.h @@ -419,6 +419,22 @@ template __host__ __device__ constexpr bool unused(T &&) {return true;} +// Define a helper macro to properly suppress warnings +#define _TEST_TOSTRING2(x) #x +#define _TEST_TOSTRING(x) _TEST_TOSTRING2(x) +#if defined(__NVCC_DIAG_PRAGMA_SUPPORT__) +# define TEST_NV_DIAG_SUPPRESS(WARNING) _Pragma(_TEST_TOSTRING(nv_diag_suppress WARNING)) +#else +# define TEST_NV_DIAG_SUPPRESS(WARNING) _Pragma(_TEST_TOSTRING(diag_suppress WARNING)) +#endif + +#define TEST_CONSTEXPR_GLOBAL _LIBCUDACXX_CONSTEXPR_GLOBAL + +// Some convenience macros for checking nvcc versions +#if defined(TEST_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1103000 +#define TEST_COMPILER_NVCC_BELOW_11_3 +#endif // defined(TEST_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1103000 + #if defined(__GNUC__) #pragma GCC diagnostic pop #endif diff --git a/libcudacxx/include/cuda/std/detail/__annotated_ptr b/libcudacxx/include/cuda/std/detail/__annotated_ptr index ab18ce4d3a..d0f2cd7e5e 100644 --- a/libcudacxx/include/cuda/std/detail/__annotated_ptr +++ b/libcudacxx/include/cuda/std/detail/__annotated_ptr @@ -60,20 +60,20 @@ namespace __detail_ap { void* __associate_address_space(void* __ptr, _Property __prop) { if (std::is_same<_Property, access_property::shared>::value == true) { bool __b = __isShared(__ptr); -#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE - _LIBCUDACXX_DEBUG_ASSERT(__b == true); -#endif + _LIBCUDACXX_ASSERT(__b, ""); +#if !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_2) __builtin_assume(__b); +#endif // !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_2) } else if (std::is_same<_Property, access_property::global>::value == true || std::is_same<_Property, access_property::normal>::value == true || std::is_same<_Property, access_property::persisting>::value == true || std::is_same<_Property, access_property::streaming>::value == true || std::is_same<_Property, access_property>::value) { bool __b = __isGlobal(__ptr); -#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE - _LIBCUDACXX_DEBUG_ASSERT(__b == true); -#endif + _LIBCUDACXX_ASSERT(__b, ""); +#if !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_2) __builtin_assume(__b); +#endif // !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_2) } return __ptr; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/__concept_macros.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/__concept_macros.h index d84605b3db..0486b53c84 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/__concept_macros.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/__concept_macros.h @@ -244,11 +244,15 @@ #define _LIBCUDACXX_TEMPLATE(...) \ template <__VA_ARGS__> _LIBCUDACXX_PP_EXPAND /**/ #define _LIBCUDACXX_AND && /**/ +#define _LIBCUDACXX_TRAILING_REQUIRES(...) \ + -> __VA_ARGS__ _LIBCUDACXX_PP_EXPAND #else #define _LIBCUDACXX_TEMPLATE(...) \ template <__VA_ARGS__ _LIBCUDACXX_TEMPLATE_SFINAE_AUX_ /**/ #define _LIBCUDACXX_AND \ &&_LIBCUDACXX_true_, int > = 0, _Concept::_Enable_if_t < /**/ +#define _LIBCUDACXX_TRAILING_REQUIRES(...) \ + -> _Concept::_Requires_t<__VA_ARGS__ _LIBCUDACXX_TRAILING_REQUIRES_AUX_ #endif #define _LIBCUDACXX_TEMPLATE_SFINAE(...) \ @@ -260,6 +264,8 @@ __VA_ARGS__) && \ _LIBCUDACXX_true_, \ int > = 0 > /**/ +#define _LIBCUDACXX_TRAILING_REQUIRES_AUX_(...) \ + , _LIBCUDACXX_PP_CAT(_LIBCUDACXX_TEMPLATE_SFINAE_AUX_3_, __VA_ARGS__)> /**/ #define _LIBCUDACXX_TEMPLATE_SFINAE_AUX_3_requires namespace _Concept { diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/convertible_to.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/convertible_to.h index f6fd8c4b71..b2a869dcd7 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/convertible_to.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/convertible_to.h @@ -38,8 +38,8 @@ concept convertible_to = #elif _LIBCUDACXX_STD_VER > 11 #if defined(_LIBCUDACXX_COMPILER_MSVC) -#pragma nv_diag_suppress 1211 // nonstandard cast to array type ignored -#endif +_LIBCUDACXX_NV_DIAG_SUPPRESS(1211) // nonstandard cast to array type ignored +#endif // _LIBCUDACXX_COMPILER_MSVC // We cannot put this conversion check with the other constraint, as types with deleted operator will break here template @@ -64,8 +64,8 @@ template _LIBCUDACXX_CONCEPT convertible_to = _LIBCUDACXX_FRAGMENT(__convertible_to_, _From, _To); #if defined(_LIBCUDACXX_COMPILER_MSVC) -#pragma nv_diag_default 1211 // nonstandard cast to array type ignored -#endif +_LIBCUDACXX_NV_DIAG_DEFAULT(1211) // nonstandard cast to array type ignored +#endif // _LIBCUDACXX_COMPILER_MSVC #endif // _LIBCUDACXX_STD_VER > 11 diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/swappable.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/swappable.h index 35e550c050..1ca8cb9b78 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/swappable.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__concepts/swappable.h @@ -36,8 +36,8 @@ #endif #if defined(_LIBCUDACXX_COMPILER_MSVC) -#pragma nv_diag_suppress 461 // nonstandard cast to array type ignored -#endif +_LIBCUDACXX_NV_DIAG_SUPPRESS(461) // nonstandard cast to array type ignored +#endif // _LIBCUDACXX_COMPILER_MSVC #if _LIBCUDACXX_STD_VER > 11 @@ -93,9 +93,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_CPO(__swap) #if _LIBCUDACXX_STD_VER > 17 && !defined(_LIBCUDACXX_COMPILER_NVHPC) // nvbug4051640 struct __fn; -#if defined(_LIBCUDACXX_COMPILER_NVCC) -# pragma nv_diag_suppress 2642 -#endif // _LIBCUDACXX_COMPILER_NVCC +_LIBCUDACXX_NV_DIAG_SUPPRESS(2642) template concept __swappable_arrays = !__unqualified_swappable_with<_Tp(&)[_Size], _Up(&)[_Size]> && @@ -103,9 +101,8 @@ _LIBCUDACXX_BEGIN_NAMESPACE_CPO(__swap) requires(_Tp(& __t)[_Size], _Up(& __u)[_Size], const __fn& __swap) { __swap(__t[0], __u[0]); }; -#if defined(_LIBCUDACXX_COMPILER_NVCC) -# pragma nv_diag_default 2642 -#endif // _LIBCUDACXX_COMPILER_NVCC +_LIBCUDACXX_NV_DIAG_DEFAULT(2642) + #else template _LIBCUDACXX_INLINE_VAR constexpr bool __swappable_arrays = false; @@ -218,7 +215,8 @@ _LIBCUDACXX_END_NAMESPACE_STD #endif // _LIBCUDACXX_STD_VER > 11 #if defined(_LIBCUDACXX_COMPILER_MSVC) -#pragma nv_diag_default 461 // nonstandard cast to array type ignored -#endif +_LIBCUDACXX_NV_DIAG_DEFAULT(461) // nonstandard cast to array type ignored +#endif // _LIBCUDACXX_COMPILER_MSVC + #endif // _LIBCUDACXX___CONCEPTS_SWAPPABLE_H diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__config b/libcudacxx/include/cuda/std/detail/libcxx/include/__config index 9d929dbca7..626bd67fc9 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__config +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__config @@ -37,6 +37,18 @@ # define _LIBCUDACXX_COMPILER_CLANG_CUDA #endif +// Some convenience macros to filter nvcc versions +#if defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1102000 +#define _LIBCUDACXX_COMPILER_NVCC_BELOW_11_2 +#endif // defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1102000 +#if defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1103000 +#define _LIBCUDACXX_COMPILER_NVCC_BELOW_11_3 +#endif // defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1103000 + +#if defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1108000 +#define _LIBCUDACXX_COMPILER_NVCC_BELOW_11_8 +#endif // defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1108000 + #if defined(_MSC_VER) && !defined(__clang__) # define _LIBCUDACXX_HAS_PRAGMA_MSVC_WARNING # if !defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING) @@ -629,7 +641,7 @@ extern "C++" { #define _LIBCUDACXX_IS_LVALUE_REFERENCE(...) __is_lvalue_reference(__VA_ARGS__) #endif // __check_builtin(is_lvalue_reference) -#if defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1103000 +#if defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) #define _LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK #endif // nvcc < 11.3 @@ -655,7 +667,7 @@ extern "C++" { #define _LIBCUDACXX_IS_OBJECT(...) __is_object(__VA_ARGS__) #endif // __check_builtin(is_object) -#if defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1103000 +#if defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) #define _LIBCUDACXX_USE_IS_OBJECT_FALLBACK #endif // nvcc < 11.3 @@ -757,7 +769,7 @@ extern "C++" { #define _LIBCUDACXX_IS_UNSIGNED(...) __is_unsigned(__VA_ARGS__) #endif // __check_builtin(is_unsigned) -#if defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_CUDACC_VER < 1103000 +#if defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) #define _LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK #endif // nvcc < 11.3 @@ -823,6 +835,29 @@ extern "C++" { #define _LIBCUDACXX_UNDERLYING_TYPE(...) __underlying_type(__VA_ARGS__) #endif // __check_builtin(underlying_type) +#define _LIBCUDACXX_TOSTRING2(_STR) #_STR +#define _LIBCUDACXX_TOSTRING(_STR) _LIBCUDACXX_TOSTRING2(_STR) +#if defined(_LIBCUDACXX_COMPILER_NVCC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#if defined(__NVCC_DIAG_PRAGMA_SUPPORT__) +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) \ + _Pragma(_LIBCUDACXX_TOSTRING(nv_diagnostic push)) \ + _Pragma(_LIBCUDACXX_TOSTRING(nv_diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(nv_diagnostic pop)) +#elif defined(_LIBCUDACXX_COMPILER_NVHPC) +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) \ + _Pragma(_LIBCUDACXX_TOSTRING(diagnostic push)) \ + _Pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diagnostic pop)) +#else // _LIBCUDACXX_COMPILER_NVCC_BELOW_11_3 +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diag_default _WARNING)) +#endif // !__NVCC_DIAG_PRAGMA_SUPPORT__ +#else // ^^^ _LIBCUDACXX_COMPILER_NVCC || _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv other compiler vvv +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) +#endif // other compilers + #if defined(_LIBCUDACXX_COMPILER_CLANG) // _LIBCUDACXX_ALTERNATE_STRING_LAYOUT is an old name for @@ -930,8 +965,6 @@ typedef __char32_t char32_t; #elif defined(_LIBCUDACXX_COMPILER_MSVC) -#define _LIBCUDACXX_TOSTRING2(x) #x -#define _LIBCUDACXX_TOSTRING(x) _LIBCUDACXX_TOSTRING2(x) #define _LIBCUDACXX_WARNING(x) __pragma(message(__FILE__ "(" _LIBCUDACXX_TOSTRING(__LINE__) ") : warning note: " x)) // https://github.com/microsoft/STL/blob/master/stl/inc/yvals_core.h#L353 @@ -1104,7 +1137,7 @@ typedef __char32_t char32_t; // [[msvc::no_unique_address]] though. If/when it does implement // [[msvc::no_unique_address]], this should be preferred though. # define _LIBCUDACXX_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] -#elif (defined(_LIBCUDACXX_COMPILER_NVCC) && (_LIBCUDACXX_CUDACC_VER < 1100000)) \ +#elif defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) \ || (__has_cpp_attribute(no_unique_address) < 201803L) # define _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS # define _LIBCUDACXX_NO_UNIQUE_ADDRESS @@ -1627,7 +1660,7 @@ typedef unsigned int char32_t; // by defining _LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS. // NVCC 11.1 and 11.2 are broken with the deprecated attribute, so disable it #if !defined(_LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS) \ - && (!defined(_LIBCUDACXX_COMPILER_NVCC) || _LIBCUDACXX_CUDACC_VER > 1102000) + && !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) # if __has_attribute(deprecated) # define _LIBCUDACXX_DEPRECATED __attribute__ ((deprecated)) # elif _LIBCUDACXX_STD_VER > 11 @@ -1708,8 +1741,6 @@ typedef unsigned int char32_t; #endif # ifdef _LIBCUDACXX_COMPILER_CLANG -# define _LIBCUDACXX_TOSTRING2(x) #x -# define _LIBCUDACXX_TOSTRING(x) _LIBCUDACXX_TOSTRING2(x) # define _LIBCUDACXX_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") # define _LIBCUDACXX_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") # define _LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCUDACXX_TOSTRING(clang diagnostic ignored str)) @@ -2045,6 +2076,8 @@ extern "C" _LIBCUDACXX_FUNC_VIS void __sanitizer_annotate_contiguous_container( #define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS #elif defined(_MSC_VER) #define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS +#elif defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_8) +#define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS #endif // FIXME: Correct this macro when either (A) a feature test macro for the @@ -2168,6 +2201,17 @@ extern "C" _LIBCUDACXX_FUNC_VIS void __sanitizer_annotate_contiguous_container( # define _LIBCUDACXX_TRAIT(__TRAIT, ...) __TRAIT<__VA_ARGS__>::value #endif +// Older nvcc do not handle the constraint of `construct_at` in earlier std modes +// So to preserve our performance optimization we default to the unconstrained +// `__construct_at` and only in C++20 use `construct_at` +#if _LIBCUDACXX_STD_VER > 17 +# define _LIBCUDACXX_CONSTRUCT_AT(_LOCATION, ...) \ + _CUDA_VSTD::construct_at(_CUDA_VSTD::addressof(_LOCATION), __VA_ARGS__) +#else +# define _LIBCUDACXX_CONSTRUCT_AT(_LOCATION, ...) \ + _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(_LOCATION), __VA_ARGS__) +#endif + #if !defined(_LIBCUDACXX_DISABLE_EXEC_CHECK) #if defined(__CUDACC__) \ && !defined(_LIBCUDACXX_COMPILER_NVRTC) \ diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/expected.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/expected.h index 2e02cf72c4..ab44830bb8 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/expected.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/expected.h @@ -176,9 +176,9 @@ class expected : private __expected_move_assign<_Tp, _Err> : __base(__other.__has_val_) { if (__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__val_), __other.__union_.__val_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__val_, __other.__union_.__val_); } else { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), __other.__union_.__unex_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, __other.__union_.__unex_); } } @@ -193,9 +193,9 @@ class expected : private __expected_move_assign<_Tp, _Err> : __base(__other.__has_val_) { if (__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__val_), __other.__union_.__val_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__val_, __other.__union_.__val_); } else { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), __other.__union_.__unex_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, __other.__union_.__unex_); } } @@ -211,9 +211,9 @@ class expected : private __expected_move_assign<_Tp, _Err> : __base(__other.__has_val_) { if (__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__val_), _CUDA_VSTD::move(__other.__union_.__val_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__val_, _CUDA_VSTD::move(__other.__union_.__val_)); } else { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), _CUDA_VSTD::move(__other.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, _CUDA_VSTD::move(__other.__union_.__unex_)); } } @@ -228,9 +228,9 @@ class expected : private __expected_move_assign<_Tp, _Err> : __base(__other.__has_val_) { if (__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__val_), _CUDA_VSTD::move(__other.__union_.__val_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__val_, _CUDA_VSTD::move(__other.__union_.__val_)); } else { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), _CUDA_VSTD::move(__other.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, _CUDA_VSTD::move(__other.__union_.__unex_)); } } @@ -409,7 +409,7 @@ class expected : private __expected_move_assign<_Tp, _Err> _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(this->__union_.__unex_)); this->__has_val_ = true; } - return *_CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__val_), _CUDA_VSTD::forward<_Args>(__args)...); + return *_LIBCUDACXX_CONSTRUCT_AT(this->__union_.__val_, _CUDA_VSTD::forward<_Args>(__args)...); } _LIBCUDACXX_TEMPLATE(class _Up, class... _Args) @@ -422,20 +422,22 @@ class expected : private __expected_move_assign<_Tp, _Err> _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(this->__union_.__unex_)); this->__has_val_ = true; } - return *_CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__val_), __il, _CUDA_VSTD::forward<_Args>(__args)...); + return *_LIBCUDACXX_CONSTRUCT_AT(this->__union_.__val_, __il, _CUDA_VSTD::forward<_Args>(__args)...); } public: // [expected.object.swap], swap + template + static constexpr bool __can_swap = _LIBCUDACXX_TRAIT(is_swappable, _Tp2) + && _LIBCUDACXX_TRAIT(is_swappable, _Err) + && _LIBCUDACXX_TRAIT(is_move_constructible, _Tp2) + && _LIBCUDACXX_TRAIT(is_move_constructible, _Err) + && (_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Tp2) + || _LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Err)); + _LIBCUDACXX_TEMPLATE(class _Tp2 = _Tp) - (requires _LIBCUDACXX_TRAIT(is_swappable, _Tp2) _LIBCUDACXX_AND - _LIBCUDACXX_TRAIT(is_swappable, _Err) _LIBCUDACXX_AND - _LIBCUDACXX_TRAIT(is_move_constructible, _Tp2) _LIBCUDACXX_AND - _LIBCUDACXX_TRAIT(is_move_constructible, _Err) _LIBCUDACXX_AND - (_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Tp2) || - _LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Err)) - ) + (requires __can_swap<_Tp2>) _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 void swap(expected<_Tp2, _Err>& __rhs) noexcept(_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Tp2) && @@ -460,18 +462,15 @@ class expected : private __expected_move_assign<_Tp, _Err> } } - _LIBCUDACXX_TEMPLATE(class _Tp2 = _Tp) - (requires _LIBCUDACXX_TRAIT(is_swappable, _Tp2) _LIBCUDACXX_AND - _LIBCUDACXX_TRAIT(is_swappable, _Err) _LIBCUDACXX_AND - _LIBCUDACXX_TRAIT(is_move_constructible, _Tp2) _LIBCUDACXX_AND - _LIBCUDACXX_TRAIT(is_move_constructible, _Err) _LIBCUDACXX_AND - (_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Tp2) || - _LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Err)) - ) + template friend _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 - void swap(expected& __x, expected& __y) noexcept(noexcept(__x.swap(__y))) + auto swap(expected& __x, expected& __y) noexcept(_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Tp2) && + _LIBCUDACXX_TRAIT(is_nothrow_swappable, _Tp2) && + _LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Err) && + _LIBCUDACXX_TRAIT(is_nothrow_swappable, _Err)) + _LIBCUDACXX_TRAILING_REQUIRES(void)(requires __can_swap<_Tp2>) { - __x.swap(__y); + return __x.swap(__y); // some compiler warn about non void function without return } // [expected.object.obs], observers @@ -1108,7 +1107,7 @@ class expected : private __expected_move_assign : __base(__other.__has_val_) { if (!__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), __other.__union_.__unex_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, __other.__union_.__unex_); } } @@ -1122,7 +1121,7 @@ class expected : private __expected_move_assign : __base(__other.__has_val_) { if (!__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), __other.__union_.__unex_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, __other.__union_.__unex_); } } @@ -1136,7 +1135,7 @@ class expected : private __expected_move_assign : __base(__other.__has_val_) { if (!__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), _CUDA_VSTD::move(__other.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, _CUDA_VSTD::move(__other.__union_.__unex_)); } } @@ -1150,7 +1149,7 @@ class expected : private __expected_move_assign : __base(__other.__has_val_) { if (!__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), _CUDA_VSTD::move(__other.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, _CUDA_VSTD::move(__other.__union_.__unex_)); } } @@ -1234,7 +1233,7 @@ class expected : private __expected_move_assign _LIBCUDACXX_TRAIT(is_nothrow_constructible, _Err, const _OtherErr&)) // strengthened { if (this->__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), __un.error()); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, __un.error()); this->__has_val_ = false; } else { this->__union_.__unex_ = __un.error(); @@ -1252,7 +1251,7 @@ class expected : private __expected_move_assign _LIBCUDACXX_TRAIT(is_nothrow_constructible, _Err, _OtherErr)) { if (this->__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), _CUDA_VSTD::move(__un.error())); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, _CUDA_VSTD::move(__un.error())); this->__has_val_ = false; } else { this->__union_.__unex_ = _CUDA_VSTD::move(__un.error()); @@ -1270,14 +1269,15 @@ class expected : private __expected_move_assign } // [expected.void.swap], swap + template + static constexpr bool __can_swap = _LIBCUDACXX_TRAIT(is_swappable, _Err2) + && _LIBCUDACXX_TRAIT(is_move_constructible, _Err2); + _LIBCUDACXX_TEMPLATE(class _Err2 = _Err) - (requires _LIBCUDACXX_TRAIT(is_swappable, _Err2) _LIBCUDACXX_AND - _LIBCUDACXX_TRAIT(is_move_constructible, _Err2) - ) + (requires __can_swap<_Err2>) _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 - void swap(expected& __rhs) - noexcept(_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Err2) && - _LIBCUDACXX_TRAIT(is_nothrow_swappable, _Err2)) + void swap(expected& __rhs) noexcept(_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Err2) && + _LIBCUDACXX_TRAIT(is_nothrow_swappable, _Err2)) { if (this->__has_val_) { if (!__rhs.__has_val_) { @@ -1293,14 +1293,13 @@ class expected : private __expected_move_assign } } - _LIBCUDACXX_TEMPLATE(class _Err2 = _Err) - (requires _LIBCUDACXX_TRAIT(is_swappable, _Err2) _LIBCUDACXX_AND - _LIBCUDACXX_TRAIT(is_move_constructible, _Err2) - ) + template friend _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 - void swap(expected& __x, expected& __y) noexcept(noexcept(__x.swap(__y))) + auto swap(expected& __x, expected& __y) noexcept(_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Err2) && + _LIBCUDACXX_TRAIT(is_nothrow_swappable, _Err2)) + _LIBCUDACXX_TRAILING_REQUIRES(void)(requires __can_swap<_Err2>) { - __x.swap(__y); + return __x.swap(__y); // some compiler warn about non void function without return } // [expected.void.obs], observers diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/expected_base.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/expected_base.h index f752499ede..35327cf896 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/expected_base.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/expected_base.h @@ -365,24 +365,26 @@ struct __expected_storage : __expected_destruct<_Tp, _Err> { using __base = __expected_destruct<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __expected_storage() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_storage(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 _LIBCUDACXX_TEMPLATE(class _T1, class _T2, class... _Args) (requires _LIBCUDACXX_TRAIT(is_nothrow_constructible, _T1, _Args...)) static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 void __reinit_expected(_T1& __newval, _T2& __oldval, _Args&&... __args) noexcept { _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(__oldval)); - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__newval), _CUDA_VSTD::forward<_Args>(__args)...); + _LIBCUDACXX_CONSTRUCT_AT(__newval, _CUDA_VSTD::forward<_Args>(__args)...); } _LIBCUDACXX_TEMPLATE(class _T1, class _T2, class... _Args) @@ -393,7 +395,7 @@ struct __expected_storage : __expected_destruct<_Tp, _Err> void __reinit_expected(_T1& __newval, _T2& __oldval, _Args&&... __args) { _T1 __tmp(_CUDA_VSTD::forward<_Args>(__args)...); _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(__oldval)); - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__newval), _CUDA_VSTD::move(__tmp)); + _LIBCUDACXX_CONSTRUCT_AT(__newval, _CUDA_VSTD::move(__tmp)); } _LIBCUDACXX_TEMPLATE(class _T1, class _T2, class... _Args) @@ -408,8 +410,8 @@ struct __expected_storage : __expected_destruct<_Tp, _Err> _T2 __tmp(_CUDA_VSTD::move(__oldval)); _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(__oldval)); auto __trans = - _CUDA_VSTD::__make_exception_guard([&] { _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__oldval), _CUDA_VSTD::move(__tmp)); }); - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__newval), _CUDA_VSTD::forward<_Args>(__args)...); + _CUDA_VSTD::__make_exception_guard([&] { _LIBCUDACXX_CONSTRUCT_AT(__oldval, _CUDA_VSTD::move(__tmp)); }); + _LIBCUDACXX_CONSTRUCT_AT(__newval, _CUDA_VSTD::forward<_Args>(__args)...); __trans.__complete(); } @@ -420,12 +422,12 @@ struct __expected_storage : __expected_destruct<_Tp, _Err> _Err __tmp(_CUDA_VSTD::move(__with_err.__union_.__unex_)); _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(__with_err.__union_.__unex_)); auto __trans = _CUDA_VSTD::__make_exception_guard([&] { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__with_err.__union_.__unex_), _CUDA_VSTD::move(__tmp)); + _LIBCUDACXX_CONSTRUCT_AT(__with_err.__union_.__unex_, _CUDA_VSTD::move(__tmp)); }); - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__with_err.__union_.__val_), _CUDA_VSTD::move(__with_val.__union_.__val_)); + _LIBCUDACXX_CONSTRUCT_AT(__with_err.__union_.__val_, _CUDA_VSTD::move(__with_val.__union_.__val_)); __trans.__complete(); _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(__with_val.__union_.__val_)); - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__with_val.__union_.__unex_), _CUDA_VSTD::move(__tmp)); + _LIBCUDACXX_CONSTRUCT_AT(__with_val.__union_.__unex_, _CUDA_VSTD::move(__tmp)); __with_val.__has_val_ = false; __with_err.__has_val_ = true; } @@ -440,12 +442,12 @@ struct __expected_storage : __expected_destruct<_Tp, _Err> _Tp __tmp(_CUDA_VSTD::move(__with_val.__union_.__val_)); _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(__with_val.__union_.__val_)); auto __trans = _CUDA_VSTD::__make_exception_guard([&] { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__with_val.__union_.__val_), _CUDA_VSTD::move(__tmp)); + _LIBCUDACXX_CONSTRUCT_AT(__with_val.__union_.__val_, _CUDA_VSTD::move(__tmp)); }); - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__with_val.__union_.__unex_), _CUDA_VSTD::move(__with_err.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(__with_val.__union_.__unex_, _CUDA_VSTD::move(__with_err.__union_.__unex_)); __trans.__complete(); _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(__with_err.__union_.__unex_)); - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__with_err.__union_.__val_), _CUDA_VSTD::move(__tmp)); + _LIBCUDACXX_CONSTRUCT_AT(__with_err.__union_.__val_, _CUDA_VSTD::move(__tmp)); __with_val.__has_val_ = false; __with_err.__has_val_ = true; } @@ -457,17 +459,19 @@ template { using __base = __expected_storage<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __expected_copy() noexcept = default; - template + template = 0> _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_copy(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; template @@ -475,17 +479,19 @@ struct __expected_copy<_Tp, _Err, false> : __expected_storage<_Tp, _Err> { using __base = __expected_storage<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_copy(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 - __expected_copy() noexcept = default; + constexpr __expected_copy() noexcept = default; _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 __expected_copy(const __expected_copy& __other) @@ -494,9 +500,9 @@ struct __expected_copy<_Tp, _Err, false> : __expected_storage<_Tp, _Err> : __base(__other.__has_val_) { if (__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__val_), __other.__union_.__val_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__val_, __other.__union_.__val_); } else { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), __other.__union_.__unex_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, __other.__union_.__unex_); } } @@ -511,32 +517,36 @@ template { using __base = __expected_copy<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __expected_move() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_move(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; template struct __expected_move<_Tp, _Err, false> : __expected_copy<_Tp, _Err> { using __base = __expected_copy<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_move(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __expected_move() = default; __expected_move(const __expected_move&) = default; @@ -548,9 +558,9 @@ struct __expected_move<_Tp, _Err, false> : __expected_copy<_Tp, _Err> : __base(__other.__has_val_) { if (__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__val_), _CUDA_VSTD::move(__other.__union_.__val_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__val_, _CUDA_VSTD::move(__other.__union_.__val_)); } else { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), _CUDA_VSTD::move(__other.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, _CUDA_VSTD::move(__other.__union_.__unex_)); } } @@ -568,32 +578,36 @@ template { using __base = __expected_move<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __expected_copy_assign() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_copy_assign(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; template struct __expected_copy_assign<_Tp, _Err, false> : __expected_move<_Tp, _Err> { using __base = __expected_move<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_copy_assign(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __expected_copy_assign() = default; __expected_copy_assign(const __expected_copy_assign&) = default; @@ -633,32 +647,36 @@ template { using __base = __expected_copy_assign<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __expected_move_assign() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_move_assign(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; template struct __expected_move_assign<_Tp, _Err, false> : __expected_copy_assign<_Tp, _Err> { using __base = __expected_copy_assign<_Tp, _Err>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_move_assign(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __expected_move_assign() = default; __expected_move_assign(const __expected_move_assign&) = default; @@ -832,22 +850,24 @@ template struct __expected_storage : __expected_destruct { using __base = __expected_destruct; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __expected_storage() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_storage(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 void __swap_val_unex_impl(__expected_storage& __with_val, __expected_storage& __with_err) noexcept(_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Err)) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(__with_val.__union_.__unex_), _CUDA_VSTD::move(__with_err.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(__with_val.__union_.__unex_, _CUDA_VSTD::move(__with_err.__union_.__unex_)); _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(__with_err.__union_.__unex_)); __with_val.__has_val_ = false; __with_err.__has_val_ = true; @@ -858,15 +878,17 @@ template struct __expected_copy : __expected_storage { using __base = __expected_storage; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_copy(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 constexpr __expected_copy() = default; @@ -876,7 +898,7 @@ struct __expected_copy : __expected_storage : __base(__other.__has_val_) { if (!__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), __other.__union_.__unex_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, __other.__union_.__unex_); } } @@ -889,15 +911,17 @@ template struct __expected_move : __expected_copy { using __base = __expected_copy; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_move(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __expected_move() = default; __expected_move(const __expected_move&) = default; @@ -908,7 +932,7 @@ struct __expected_move : __expected_copy : __base(__other.__has_val_) { if (!__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), _CUDA_VSTD::move(__other.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, _CUDA_VSTD::move(__other.__union_.__unex_)); } } @@ -920,15 +944,17 @@ template struct __expected_copy_assign : __expected_move { using __base = __expected_move; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_copy_assign(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __expected_copy_assign() = default; __expected_copy_assign(const __expected_copy_assign&) = default; @@ -942,7 +968,7 @@ struct __expected_copy_assign : __expected_move if (this->__has_val_ && __other.__has_val_) { // nothing to do } else if (this->__has_val_ && !__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), __other.__union_.__unex_); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, __other.__union_.__unex_); this->__has_val_ = false; } else if (!this->__has_val_ && __other.__has_val_) { _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(this->__union_.__unex_)); @@ -960,15 +986,17 @@ template struct __expected_move_assign : __expected_copy_assign { using __base = __expected_copy_assign; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __expected_move_assign(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __expected_move_assign() = default; __expected_move_assign(const __expected_move_assign&) = default; @@ -983,7 +1011,7 @@ struct __expected_move_assign : __expected_copy_assign__has_val_ && __other.__has_val_) { // nothing to do } else if (this->__has_val_ && !__other.__has_val_) { - _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(this->__union_.__unex_), _CUDA_VSTD::move(__other.__union_.__unex_)); + _LIBCUDACXX_CONSTRUCT_AT(this->__union_.__unex_, _CUDA_VSTD::move(__other.__union_.__unex_)); this->__has_val_ = false; } else if (!this->__has_val_ && __other.__has_val_) { _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(this->__union_.__unex_)); diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/unexpected.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/unexpected.h index 2deb81d036..2191af03c6 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/unexpected.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/unexpected.h @@ -138,15 +138,15 @@ class unexpected { template friend _LIBCUDACXX_INLINE_VISIBILITY constexpr _LIBCUDACXX_NODISCARD_EXT bool operator==(const unexpected& __lhs, const unexpected<_UErr>& __rhs) noexcept( - noexcept(static_cast(__lhs.__unex_ == __rhs.error()))) { - return __lhs.__unex_ == __rhs.error(); + noexcept(static_cast(__lhs.error() == __rhs.error()))) { + return __lhs.error() == __rhs.error(); } #if _LIBCUDACXX_STD_VER < 20 template _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_NODISCARD_EXT friend constexpr bool operator!=(const unexpected& __lhs, const unexpected<_UErr>& __rhs) noexcept( - noexcept(static_cast(__lhs.__unex_ != __rhs.error()))) { - return __lhs.__unex_ != __rhs.error(); + noexcept(static_cast(__lhs.error() != __rhs.error()))) { + return __lhs.error() != __rhs.error(); } #endif diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__mdspan/standard_layout_static_array.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__mdspan/standard_layout_static_array.h index 65da097765..217c3876ec 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__mdspan/standard_layout_static_array.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__mdspan/standard_layout_static_array.h @@ -72,16 +72,15 @@ namespace __detail { //============================================================================== -_LIBCUDACXX_INLINE_VAR constexpr struct - __construct_psa_from_dynamic_exts_values_tag_t { -} __construct_psa_from_dynamic_exts_values_tag = {}; +struct __construct_psa_from_dynamic_exts_values_tag_t {}; +_LIBCUDACXX_CPO_ACCESSIBILITY __construct_psa_from_dynamic_exts_values_tag_t __construct_psa_from_dynamic_exts_values_tag; -_LIBCUDACXX_INLINE_VAR constexpr struct - __construct_psa_from_all_exts_values_tag_t { -} __construct_psa_from_all_exts_values_tag = {}; +struct __construct_psa_from_all_exts_values_tag_t {}; +_LIBCUDACXX_CPO_ACCESSIBILITY __construct_psa_from_all_exts_values_tag_t __construct_psa_from_all_exts_values_tag; struct __construct_psa_from_all_exts_array_tag_t {}; -template struct __construct_psa_from_dynamic_exts_array_tag_t {}; +template +struct __construct_psa_from_dynamic_exts_array_tag_t {}; //============================================================================== @@ -614,7 +613,16 @@ struct __partially_static_sizes_tagged using __tag_t = _Tag; using __psa_impl_t = __standard_layout_psa< _Tag, T, _static_t, _CUDA_VSTD::integer_sequence<_static_t, __values_or_sentinals...>>; +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) + template = 0> + __MDSPAN_FORCE_INLINE_FUNCTION constexpr + __partially_static_sizes_tagged(_Args&&... __args) noexcept(noexcept(__psa_impl_t(_CUDA_VSTD::declval<_Args>()...))) + : __psa_impl_t(_CUDA_VSTD::forward<_Args>(__args)...) + {} +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __psa_impl_t::__psa_impl_t; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 #ifdef __MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND __MDSPAN_INLINE_FUNCTION #endif @@ -657,7 +665,16 @@ struct __partially_static_sizes __partially_static_sizes_tagged<_UTag, T, _static_t, __values_or_sentinals...>&& __vals ) noexcept : __base_t(_CUDA_VSTD::move(__vals)) { } public: +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) + template = 0> + __MDSPAN_FORCE_INLINE_FUNCTION constexpr + __partially_static_sizes(_Args&&... __args) noexcept(noexcept(__base_t(_CUDA_VSTD::declval<_Args>()...))) + : __base_t(_CUDA_VSTD::forward<_Args>(__args)...) + {} +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base_t::__base_t; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 #ifdef __MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND __MDSPAN_INLINE_FUNCTION diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__mdspan/static_array.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__mdspan/static_array.h index 9659c46f06..3e65c801aa 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__mdspan/static_array.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__mdspan/static_array.h @@ -262,7 +262,18 @@ class __partially_static_array_with_sentinal private: using __base_t = typename __partially_static_array_impl_maker<_Tp, _static_t, _ValsSeq, __sentinal>::__impl_base; public: +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) + constexpr __partially_static_array_with_sentinal() = default; + + template + __MDSPAN_FORCE_INLINE_FUNCTION constexpr + __partially_static_array_with_sentinal(_Args&&... __args) noexcept(noexcept(__base_t(_CUDA_VSTD::declval<_Args>()...))) + : __base_t(_CUDA_VSTD::forward<_Args>(__args)...) + {} +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base_t::__base_t; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; //============================================================================== @@ -276,7 +287,18 @@ struct __partially_static_sizes : using __base_t = __partially_static_array_with_sentinal< T, _static_t, _CUDA_VSTD::integer_sequence<_static_t, __values_or_sentinals...>>; public: +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) + constexpr __partially_static_sizes() = default; + + template + __MDSPAN_FORCE_INLINE_FUNCTION constexpr + __partially_static_sizes(_Args&&... __args) noexcept(noexcept(__base_t(_CUDA_VSTD::declval<_Args>()...))) + : __base_t(_CUDA_VSTD::forward<_Args>(__args)...) + {} +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base_t::__base_t; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 template __MDSPAN_FORCE_INLINE_FUNCTION constexpr __partially_static_sizes __with_tag() const noexcept { diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__memory/construct_at.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__memory/construct_at.h index ac097cdd03..44b747efd9 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__memory/construct_at.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__memory/construct_at.h @@ -99,7 +99,7 @@ construct_at(_Tp* __location, _Args&&... __args) { #endif // _LIBCUDACXX_STD_VER > 17 _LIBCUDACXX_DISABLE_EXEC_CHECK -template ()) _Tp(_CUDA_VSTD::declval<_Args>()...))> +template _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 __enable_if_t __construct_at(_Tp* __location, _Args&&... __args) { @@ -114,7 +114,7 @@ __construct_at(_Tp* __location, _Args&&... __args) { } _LIBCUDACXX_DISABLE_EXEC_CHECK -template ()) _Tp(_CUDA_VSTD::declval<_Args>()...))> +template _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 __enable_if_t<_LIBCUDACXX_TRAIT(is_trivially_constructible, _Tp, _Args...) && _LIBCUDACXX_TRAIT(is_trivially_move_assignable, _Tp), _Tp*> __construct_at(_Tp* __location, _Args&&... __args) { diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_convertible.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_convertible.h index 3daca297c5..9506d86c4c 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_convertible.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_convertible.h @@ -69,7 +69,10 @@ _LIBCUDACXX_INLINE_VAR constexpr bool is_convertible_v _LIBCUDACXX_INLINE_VISIBILITY void __test_convert(_Tp); +_LIBCUDACXX_NV_DIAG_DEFAULT(3013) // a volatile function parameter is deprecated template struct __is_convertible_test : public false_type {}; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_swappable.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_swappable.h index c1aac54e31..2a0e9f9858 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_swappable.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_swappable.h @@ -37,31 +37,27 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD template struct __is_swappable; template struct __is_nothrow_swappable; -#ifndef _LIBCUDACXX_CXX03_LANG template -using __swap_result_t = __enable_if_t::value && is_move_assignable<_Tp>::value>; -#else -template -using __swap_result_t = void; -#endif +using __swap_result_t = __enable_if_t<_LIBCUDACXX_TRAIT(is_move_constructible, _Tp) + && _LIBCUDACXX_TRAIT(is_move_assignable, _Tp)>; template -inline _LIBCUDACXX_INLINE_VISIBILITY -_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 __swap_result_t<_Tp> -swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && - is_nothrow_move_assignable<_Tp>::value); +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +__swap_result_t<_Tp> +swap(_Tp& __x, _Tp& __y) noexcept(_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Tp) + && _LIBCUDACXX_TRAIT(is_nothrow_move_assignable, _Tp)); template -inline _LIBCUDACXX_INLINE_VISIBILITY -_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 __enable_if_t<__is_swappable<_Tp>::value> -swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value); +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +__enable_if_t<__is_swappable<_Tp>::value> +swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) noexcept(__is_nothrow_swappable<_Tp>::value); namespace __detail { // ALL generic swap overloads MUST already have a declaration available at this point. template ::value && !is_void<_Up>::value> + bool _NotVoid = !_LIBCUDACXX_TRAIT(is_void, _Tp) && !_LIBCUDACXX_TRAIT(is_void, _Up)> struct __swappable_with { template @@ -84,12 +80,8 @@ struct __swappable_with<_Tp, _Up, false> : false_type {}; template ::value> struct __nothrow_swappable_with { static const bool value = -#ifndef _LIBCUDACXX_HAS_NO_NOEXCEPT noexcept(swap(_CUDA_VSTD::declval<_Tp>(), _CUDA_VSTD::declval<_Up>())) && noexcept(swap(_CUDA_VSTD::declval<_Up>(), _CUDA_VSTD::declval<_Tp>())); -#else - false; -#endif }; template diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/swap.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/swap.h index 0961b74e51..e68295e60d 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/swap.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/swap.h @@ -30,19 +30,19 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD template -inline _LIBCUDACXX_INLINE_VISIBILITY -_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 __swap_result_t<_Tp> -swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && - is_nothrow_move_assignable<_Tp>::value) { +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +__swap_result_t<_Tp> +swap(_Tp& __x, _Tp& __y) noexcept(_LIBCUDACXX_TRAIT(is_nothrow_move_constructible, _Tp) + && _LIBCUDACXX_TRAIT(is_nothrow_move_assignable, _Tp)) { _Tp __t(_CUDA_VSTD::move(__x)); __x = _CUDA_VSTD::move(__y); __y = _CUDA_VSTD::move(__t); } template -inline _LIBCUDACXX_INLINE_VISIBILITY -_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 __enable_if_t<__is_swappable<_Tp>::value> -swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +__enable_if_t<__is_swappable<_Tp>::value> +swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) noexcept(__is_nothrow_swappable<_Tp>::value) { for (size_t __i = 0; __i != _Np; ++__i) { swap(__a[__i], __b[__i]); } diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/bit b/libcudacxx/include/cuda/std/detail/libcxx/include/bit index 96b2c1abad..7dcad2b03e 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/bit +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/bit @@ -191,32 +191,42 @@ int __fallback_popc64(uint64_t __x) { inline _LIBCUDACXX_INLINE_VISIBILITY constexpr int __libcpp_ctz(unsigned __x) noexcept { -#ifdef _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3)) #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { - return (!__x) ? sizeof(unsigned) * 8 : __ffs(__x) - 1; + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return (!__x) ? sizeof(unsigned) * 8 : __ffs(__x) - 1; + ), ( + return __builtin_ctz(__x); + )) } #endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) return __binary_ctz32(static_cast(__x), 0); -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv return __builtin_ctz(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR int __libcpp_ctz(unsigned long __x) noexcept { -#ifdef _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3)) #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { - return (!__x) ? sizeof(unsigned long) * 8 : __ffsll(__x) - 1; + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return (!__x) ? sizeof(unsigned long) * 8 : __ffsll(__x) - 1; + ), ( + return __builtin_ctzl(__x); + )) } #endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) return __binary_ctz64(static_cast(__x)); -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv return __builtin_ctzl(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR @@ -225,7 +235,7 @@ int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { #if 1 //def _LIBCUDACXX_COMPILER_NVRTC #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { - NV_IF_TARGET(NV_IS_DEVICE, ( + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( return (!__x) ? sizeof(unsigned long long) * 8 : __ffsll(__x) - 1; ), ( return __builtin_ctzll(__x); @@ -236,97 +246,126 @@ int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __binary_ctz64(static_cast(__x)); #else // 0 return __builtin_ctzll(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR int __libcpp_clz(unsigned __x) _NOEXCEPT { -#ifdef _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3)) #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { - return __clz(__x); + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __clz(__x); + ), ( + return __builtin_clz(__x); + )) } #endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) - return __binary_clz32(static_cast(__x), 0); -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv return __builtin_clz(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR int __libcpp_clz(unsigned long __x) _NOEXCEPT { -#ifdef _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3)) #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { - return __clzll(__x); + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __clzll(__x); + ), ( + return __builtin_clzl(__x); + )) } #endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) return __binary_clz64(static_cast(__x)); -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv return __builtin_clzl(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR int __libcpp_clz(unsigned long long __x) _NOEXCEPT { -#ifdef _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3)) #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { - return __clzll(__x); + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __clzll(__x); + ), ( + return __builtin_clzll(__x); + )) } #endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) return __binary_clz64(static_cast(__x)); -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv return __builtin_clzll(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR int __libcpp_popcount(unsigned __x) _NOEXCEPT { -#ifdef _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3)) #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { - return __popc(__x); + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __popc(__x); + ), ( + return __builtin_popcount(__x); + )) } #endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) return __fallback_popc64(static_cast(__x)); -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv return __builtin_popcount(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR int __libcpp_popcount(unsigned long __x) _NOEXCEPT { -#ifdef _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3)) #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( return __popcll(__x); + ), ( + return __builtin_popcountl(__x); + )) } #endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) return __fallback_popc64(static_cast(__x)); -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv return __builtin_popcountl(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { -#ifdef _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3)) #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) if (!__libcpp_is_constant_evaluated()) { - return __popcll(__x); + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __popcll(__x); + ), ( + return __builtin_popcountll(__x); + )) } #endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) return __fallback_popc64(static_cast(__x)); -#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC vvv +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv return __builtin_popcountll(__x); -#endif // !_LIBCUDACXX_COMPILER_NVRTC +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 } #else // _LIBCUDACXX_COMPILER_MSVC diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/chrono b/libcudacxx/include/cuda/std/detail/libcxx/include/chrono index 797fa69a44..945b981a55 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/chrono +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/chrono @@ -861,13 +861,7 @@ constexpr chrono::year operator ""y(unsigned lo // fashion; if you include this header, the diagnostic will be suppressed // throughout the translation unit. The alternative is loosing (conforming) // chrono user-defined literals; this seems like the lesser of two evils, so... -#if defined(_LIBCUDACXX_COMPILER_NVCC) -# if (CUDART_VERSION >= 11050) -# pragma nv_diag_suppress cuda_demote_unsupported_floating_point -# else -# pragma diag_suppress cuda_demote_unsupported_floating_point -# endif -#endif +_LIBCUDACXX_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) #ifndef _LIBCUDACXX_CXX03_LANG _LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM @@ -3363,6 +3357,8 @@ _LIBCUDACXX_END_NAMESPACE_FILESYSTEM #endif // !_LIBCUDACXX_CXX03_LANG #endif // __cuda_std__ +_LIBCUDACXX_NV_DIAG_DEFAULT(cuda_demote_unsupported_floating_point) + #ifndef __cuda_std__ #include <__pragma_pop> #else diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/cmath b/libcudacxx/include/cuda/std/detail/libcxx/include/cmath index 02183dc042..66afdae145 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/cmath +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/cmath @@ -613,7 +613,9 @@ _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR __enable_if_t::value, bool> __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT { -#if __has_builtin(__builtin_isnan) +#if defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_8) + return __isnan(__lcpp_x); +#elif __has_builtin(__builtin_isnan) return __builtin_isnan(__lcpp_x); #else return isnan(__lcpp_x); @@ -633,7 +635,9 @@ _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR __enable_if_t::value, bool> __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT { -#if __has_builtin(__builtin_isinf) +#if defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_8) + return __isinf(__lcpp_x); +#elif __has_builtin(__builtin_isinf) return __builtin_isinf(__lcpp_x); #else return isinf(__lcpp_x); @@ -653,7 +657,9 @@ _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR __enable_if_t::value, bool> __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT { -#if __has_builtin(__builtin_isfinite) +#if defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_8) + return !__isinf(__lcpp_x) && !__isnan(__lcpp_x); +#elif __has_builtin(__builtin_isfinite) return __builtin_isfinite(__lcpp_x); #else return isfinite(__lcpp_x); @@ -742,7 +748,7 @@ _A1 __constexpr_fmax(_A1 __x, _A1 __y) _NOEXCEPT #else inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX float __constexpr_fmax(float __x, float __y) noexcept { -#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { if (__constexpr_isnan(__x)) return __y; @@ -756,7 +762,7 @@ _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX float __constexpr_fmax(float __x, floa inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX double __constexpr_fmax(double __x, double __y) noexcept { -#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { if (__constexpr_isnan(__x)) return __y; @@ -770,7 +776,7 @@ _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX double __constexpr_fmax(double __x, do inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX long double __constexpr_fmax(long double __x, long double __y) noexcept { -#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { if (__constexpr_isnan(__x)) return __y; @@ -802,7 +808,7 @@ _A1 __constexpr_logb(_A1 __x) template inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX _Tp __constexpr_logb(_Tp __x) { -#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { if (__x == _Tp(0)) { // raise FE_DIVBYZERO @@ -858,7 +864,7 @@ long double __constexpr_scalbn(long double __x, int __i) { template inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX _Tp __constexpr_scalbn(_Tp __x, int __exp) { -#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { if (__x == _Tp(0)) return __x; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/cstdlib b/libcudacxx/include/cuda/std/detail/libcxx/include/cstdlib index c3c52538df..d01a29973b 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/cstdlib +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/cstdlib @@ -98,17 +98,29 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 #pragma GCC system_header #endif -#ifdef __GNUC__ +#if defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_2) +#ifdef __CUDA_ARCH__ +# define _LIBCUDACXX_UNREACHABLE() __trap() +#else // ^^^ __CUDA_ARCH__ ^^^ / vvv !__CUDA_ARCH__ vvv +# define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable() +#endif // !__CUDA_ARCH__ +#elif defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) +#ifdef __CUDA_ARCH__ +# define _LIBCUDACXX_UNREACHABLE() __builtin_assume(false) +#else // ^^^ __CUDA_ARCH__ ^^^ / vvv !__CUDA_ARCH__ vvv # define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable() -#elif __has_builtin(__builtin_unreachable) +#endif // !__CUDA_ARCH__ +#elif defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_UNREACHABLE() __assume(false) +#elif defined(_LIBCUDACXX_COMPILER_GCC) || __has_builtin(__builtin_unreachable) # define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable() -#else +#else // Other compilers #ifdef __CUDA_ARCH__ # define _LIBCUDACXX_UNREACHABLE() __trap() -#else +#else // ^^^ __CUDA_ARCH__ ^^^ / vvv !__CUDA_ARCH__ vvv # define _LIBCUDACXX_UNREACHABLE() ::abort() -#endif // __CUDA_ARCH__ -#endif // !__GNUC__ +#endif // !__CUDA_ARCH__ +#endif // Other compilers #ifdef _LIBCUDACXX_COMPILER_NVHPC #define _LIBCUDACXX_UNREACHABLE_AFTER_SWITCH() diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/optional b/libcudacxx/include/cuda/std/detail/libcxx/include/optional index f7887a2f76..a0b5b95d70 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/optional +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/optional @@ -344,17 +344,19 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> using __base = __optional_destruct_base<_Tp>; using value_type = _Tp; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - constexpr __optional_storage_base() noexcept = default; - - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __optional_storage_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 + + constexpr __optional_storage_base() noexcept = default; _LIBCUDACXX_INLINE_VISIBILITY constexpr bool has_value() const noexcept @@ -426,18 +428,21 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> template ::value> struct __optional_copy_base : __optional_storage_base<_Tp> { + using __base = __optional_storage_base<_Tp>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __optional_copy_base() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr - __optional_copy_base(_Args&&... __args) noexcept(noexcept(__optional_storage_base<_Tp>(_CUDA_VSTD::declval<_Args>()...))) - : __optional_storage_base<_Tp>(_CUDA_VSTD::forward<_Args>(__args)...) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __optional_copy_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) + : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else - using __optional_storage_base<_Tp>::__optional_storage_base; -#endif +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + using __base::__base; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; template @@ -445,15 +450,17 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> { using __base = __optional_storage_base<_Tp>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr __optional_copy_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv using __base::__base; -#endif +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __optional_copy_base() = default; @@ -474,34 +481,40 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> template ::value> struct __optional_move_base : __optional_copy_base<_Tp> { + using __base = __optional_copy_base<_Tp>; -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __optional_move_base() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr - __optional_move_base(_Args&&... __args) noexcept(noexcept(__optional_copy_base<_Tp>(_CUDA_VSTD::declval<_Args>()...))) - : __optional_copy_base<_Tp>(_CUDA_VSTD::forward<_Args>(__args)...) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __optional_move_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) + : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else - using __optional_copy_base<_Tp>::__optional_copy_base; -#endif +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + using __base::__base; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; template struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> { using value_type = _Tp; - -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr - __optional_move_base(_Args&&... __args) noexcept(noexcept(__optional_copy_base<_Tp>(_CUDA_VSTD::declval<_Args>()...))) - : __optional_copy_base<_Tp>(_CUDA_VSTD::forward<_Args>(__args)...) + using __base = __optional_copy_base<_Tp>; + +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __optional_move_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) + : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else - using __optional_copy_base<_Tp>::__optional_copy_base; -#endif +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + using __base::__base; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __optional_move_base() = default; __optional_move_base(const __optional_move_base&) = default; @@ -523,31 +536,37 @@ template ::value> struct __optional_copy_assign_base : __optional_move_base<_Tp> { -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 + using __base = __optional_move_base<_Tp>; +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __optional_copy_assign_base() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr - __optional_copy_assign_base(_Args&&... __args) noexcept(noexcept(__optional_move_base<_Tp>(_CUDA_VSTD::declval<_Args>()...))) - : __optional_move_base<_Tp>(_CUDA_VSTD::forward<_Args>(__args)...) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __optional_copy_assign_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) + : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else - using __optional_move_base<_Tp>::__optional_move_base; -#endif +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + using __base::__base; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; template struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> { -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr - __optional_copy_assign_base(_Args&&... __args) noexcept(noexcept(__optional_move_base<_Tp>(_CUDA_VSTD::declval<_Args>()...))) - : __optional_move_base<_Tp>(_CUDA_VSTD::forward<_Args>(__args)...) + using __base = __optional_move_base<_Tp>; +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __optional_copy_assign_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) + : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else - using __optional_move_base<_Tp>::__optional_move_base; -#endif +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + using __base::__base; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __optional_copy_assign_base() = default; __optional_copy_assign_base(const __optional_copy_assign_base&) = default; @@ -569,33 +588,39 @@ template ::value> struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> { -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 + using __base = __optional_copy_assign_base<_Tp>; +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) constexpr __optional_move_assign_base() noexcept = default; - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr - __optional_move_assign_base(_Args&&... __args) noexcept(noexcept(__optional_copy_assign_base<_Tp>(_CUDA_VSTD::declval<_Args>()...))) - : __optional_copy_assign_base<_Tp>(_CUDA_VSTD::forward<_Args>(__args)...) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __optional_move_assign_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) + : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else - using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base; -#endif +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + using __base::__base; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 }; template struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp> { using value_type = _Tp; - -#if defined(_LIBCUDACXX_COMPILER_NVRTC) // nvbug3961621 - template - _LIBCUDACXX_INLINE_VISIBILITY constexpr - __optional_move_assign_base(_Args&&... __args) noexcept(noexcept(__optional_copy_assign_base<_Tp>(_CUDA_VSTD::declval<_Args>()...))) - : __optional_copy_assign_base<_Tp>(_CUDA_VSTD::forward<_Args>(__args)...) + using __base = __optional_copy_assign_base<_Tp>; + +// nvbug3961621 +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) && defined(_LIBCUDACXX_COMPILER_CLANG)) + template = 0> + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __optional_move_assign_base(_Args&&... __args) noexcept(noexcept(__base(_CUDA_VSTD::declval<_Args>()...))) + : __base(_CUDA_VSTD::forward<_Args>(__args)...) {} -#else - using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base; -#endif +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + using __base::__base; +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 __optional_move_assign_base() = default; __optional_move_assign_base(const __optional_move_assign_base& __opt) = default; diff --git a/libcudacxx/include/cuda/stream_ref b/libcudacxx/include/cuda/stream_ref index d37cdcf587..ca5b8b917c 100644 --- a/libcudacxx/include/cuda/stream_ref +++ b/libcudacxx/include/cuda/stream_ref @@ -108,7 +108,11 @@ public: * \param rhs The second `stream_view` to compare * \return true if equal, false if unequal */ - _LIBCUDACXX_NODISCARD_ATTRIBUTE friend bool constexpr operator==(stream_ref __lhs, stream_ref __rhs) noexcept + +#if !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) + _LIBCUDACXX_NODISCARD_ATTRIBUTE +#endif // !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) + friend constexpr bool operator==(const stream_ref& __lhs, const stream_ref& __rhs) noexcept { return __lhs.__stream == __rhs.__stream; } @@ -123,7 +127,10 @@ public: * \param rhs The second `stream_view` to compare * \return true if unequal, false if equal */ - _LIBCUDACXX_NODISCARD_ATTRIBUTE friend bool constexpr operator!=(stream_ref __lhs, stream_ref __rhs) noexcept +#if !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) + _LIBCUDACXX_NODISCARD_ATTRIBUTE +#endif // !defined(_LIBCUDACXX_COMPILER_NVCC_BELOW_11_3) + friend constexpr bool operator!=(const stream_ref& __lhs, const stream_ref& __rhs) noexcept { return __lhs.__stream != __rhs.__stream; }