From 6c443bf2dc02aa36ffae9d20b38c35e947fd3ff3 Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Thu, 26 Jan 2023 14:12:01 +0100 Subject: [PATCH] Try to fix nvrtc with respect to spaceship operator --- .../equality_comparable.compile.pass.cpp | 8 ++++++++ .../equality_comparable_with.compile.pass.cpp | 2 ++ .../concepts.totallyordered/totally_ordered.pass.cpp | 6 ++++++ .../totally_ordered_with.pass.cpp | 4 ++++ .upstream-tests/test/support/compare_types.h | 12 +++++++++++- .upstream-tests/test/support/test_macros.h | 2 +- 6 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.upstream-tests/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp b/.upstream-tests/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp index a4ab0ad446..2d455b62d2 100644 --- a/.upstream-tests/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp +++ b/.upstream-tests/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp @@ -89,8 +89,12 @@ namespace types_fit_for_purpose { #if TEST_STD_VER > 17 static_assert(equality_comparable, ""); static_assert(equality_comparable, ""); +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(equality_comparable, ""); +#ifndef __NVCC__ // nvbug3908399 static_assert(equality_comparable, ""); +#endif // !__NVCC_ +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(equality_comparable, ""); static_assert(equality_comparable, ""); static_assert(equality_comparable, ""); @@ -117,14 +121,18 @@ static_assert( !equality_comparable, ""); static_assert( !equality_comparable, ""); +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR static_assert( !equality_comparable, ""); static_assert( !equality_comparable, ""); static_assert( !equality_comparable, ""); +#ifndef __NVCC__ // nvbug3908399 static_assert( !equality_comparable, ""); +#endif // !__NVCC__ +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(!equality_comparable, ""); static_assert(!equality_comparable, ""); diff --git a/.upstream-tests/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp b/.upstream-tests/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp index 3fc1dfd1c0..508292f234 100644 --- a/.upstream-tests/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp +++ b/.upstream-tests/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp @@ -1055,6 +1055,7 @@ static_assert( static_assert( !check_equality_comparable_with(), ""); +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(check_equality_comparable_with(), ""); #ifndef __NVCC__ // nvbug3908399 @@ -1063,6 +1064,7 @@ static_assert(check_equality_comparable_with(), ""); #endif // !__NVCC__ +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR #endif // TEST_STD_VER > 17 static_assert( diff --git a/.upstream-tests/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.pass.cpp b/.upstream-tests/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.pass.cpp index e8876afca2..f012762494 100644 --- a/.upstream-tests/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.pass.cpp +++ b/.upstream-tests/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.pass.cpp @@ -116,10 +116,12 @@ static_assert(models_totally_ordered >(), ""); namespace types_fit_for_purpose { #if TEST_STD_VER > 17 +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(models_totally_ordered(), ""); #ifndef __NVCC__ // nvbug3908399 static_assert(models_totally_ordered(), ""); #endif // !__NVCC__ +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(models_totally_ordered(), ""); static_assert(models_totally_ordered(), ""); @@ -147,6 +149,7 @@ static_assert(!totally_ordered, ""); #if TEST_STD_VER > 17 static_assert(!totally_ordered, ""); static_assert(!totally_ordered, ""); +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR static_assert( !totally_ordered, ""); static_assert( @@ -157,6 +160,7 @@ static_assert( static_assert( !totally_ordered, ""); #endif // !__NVCC__ +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(!totally_ordered, ""); static_assert(!totally_ordered, ""); @@ -167,11 +171,13 @@ static_assert(!totally_ordered, ""); static_assert(totally_ordered, ""); static_assert(totally_ordered, ""); +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR #ifndef TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(totally_ordered, ""); static_assert(totally_ordered, ""); static_assert(totally_ordered, ""); #endif // TEST_HAS_NO_SPACESHIP_OPERATOR +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR #endif // TEST_STD_VER > 17 } // namespace types_fit_for_purpose diff --git a/.upstream-tests/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.pass.cpp b/.upstream-tests/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.pass.cpp index 6eba792d3a..fdbdd43d55 100644 --- a/.upstream-tests/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.pass.cpp +++ b/.upstream-tests/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.pass.cpp @@ -1021,6 +1021,7 @@ static_assert(!check_totally_ordered_with(), " static_assert(!check_totally_ordered_with(), ""); static_assert(!check_totally_ordered_with(), ""); +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR static_assert(check_totally_ordered_with(), ""); #ifndef __NVCC__ // nvbug3908399 @@ -1029,6 +1030,7 @@ static_assert(check_totally_ordered_with(), ""); #endif // !__NVCC__ +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR #endif // TEST_STD_VER > 17 static_assert( @@ -1053,6 +1055,7 @@ static_assert( cuda::std::common_reference_with && !check_totally_ordered_with(), ""); +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR #ifndef TEST_HAS_NO_SPACESHIP_OPERATOR static_assert( check_totally_ordered_with && !check_totally_ordered_with(), ""); +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR #endif // TEST_STD_VER > 17 } // namespace types_fit_for_purpose diff --git a/.upstream-tests/test/support/compare_types.h b/.upstream-tests/test/support/compare_types.h index fcf163d798..9f7521d4ee 100644 --- a/.upstream-tests/test/support/compare_types.h +++ b/.upstream-tests/test/support/compare_types.h @@ -12,6 +12,10 @@ #include #include +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR +#include +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR + // `noexcept` specifiers deliberately imperfect since not all programmers bother to put the // specifiers on their overloads. @@ -27,6 +31,7 @@ struct cxx20_friend_eq { __host__ __device__ friend bool operator==(cxx20_friend_eq const&, cxx20_friend_eq const&) = default; }; +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR struct member_three_way_comparable { auto operator<=>(member_three_way_comparable const&) const = default; }; @@ -36,6 +41,7 @@ struct friend_three_way_comparable { __host__ __device__ friend auto operator<=>(friend_three_way_comparable const&, friend_three_way_comparable const&) = default; }; #endif // !__NVCC__ +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR #endif // TEST_STD_VER > 17 struct explicit_operators { @@ -216,6 +222,7 @@ struct cxx20_friend_eq_operator_with_deleted_ne { cxx20_friend_eq_operator_with_deleted_ne const&) = delete; }; +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR struct member_three_way_comparable_with_deleted_eq { auto operator<=>(member_three_way_comparable_with_deleted_eq const&) const = default; __host__ __device__ bool operator==(member_three_way_comparable_with_deleted_eq const&) const = delete; @@ -241,6 +248,7 @@ struct friend_three_way_comparable_with_deleted_ne { friend_three_way_comparable_with_deleted_ne const&) = delete; }; #endif +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR struct one_way_eq { bool operator==(one_way_eq const&) const = default; @@ -265,6 +273,7 @@ struct explicit_bool { }; #if TEST_STD_VER > 17 +#ifndef TEST_HAS_NO_SPACESHIP_OPERATOR struct totally_ordered_with_others { auto operator<=>(totally_ordered_with_others const&) const = default; }; @@ -330,7 +339,8 @@ struct strong_ordering_totally_ordered_with { __host__ __device__ operator totally_ordered_with_others() const; }; -#endif +#endif // TEST_HAS_NO_SPACESHIP_OPERATOR +#endif // TEST_STD_VER > 17 struct eq_returns_explicit_bool { __host__ __device__ friend explicit_bool operator==(eq_returns_explicit_bool, eq_returns_explicit_bool); diff --git a/.upstream-tests/test/support/test_macros.h b/.upstream-tests/test/support/test_macros.h index e1327ff3bc..2d178efc55 100644 --- a/.upstream-tests/test/support/test_macros.h +++ b/.upstream-tests/test/support/test_macros.h @@ -262,7 +262,7 @@ // FIXME: Fix this feature check when either (A) a compiler provides a complete // implementation, or (b) a feature check macro is specified -#if defined(TEST_COMPILER_CLANG) || !defined(TEST_COMPILER_C1XX) || _MSC_VER < 1920 || _MSVC_LANG <= 201703L +#if !defined(__cpp_lib_three_way_comparison) #define TEST_HAS_NO_SPACESHIP_OPERATOR #endif