Skip to content

Commit dc321d5

Browse files
authored
fix feature test for operator<=> (#3075)
* fix feature test for operator<=> * fix `basic_any`'s `operator==` in c++20
1 parent 199f2a5 commit dc321d5

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

cudax/include/cuda/experimental/__hierarchy/hierarchy_dimensions.cuh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,9 @@ struct hierarchy_dimensions_fragment
390390
: levels(ls)
391391
{}
392392

393-
# if !defined(_CCCL_NO_THREE_WAY_COMPARISON)
394-
_CCCL_NODISCARD _CUDAX_API constexpr bool operator==(const hierarchy_dimensions_fragment&) const noexcept = default;
393+
# if !defined(_CCCL_NO_THREE_WAY_COMPARISON) && !_CCCL_COMPILER(MSVC, <, 19, 39)
394+
_CCCL_NODISCARD _CCCL_HIDE_FROM_ABI constexpr bool
395+
operator==(const hierarchy_dimensions_fragment&) const noexcept = default;
395396
# else // ^^^ !_CCCL_NO_THREE_WAY_COMPARISON ^^^ / vvv _CCCL_NO_THREE_WAY_COMPARISON vvv
396397
_CCCL_NODISCARD_FRIEND _CUDAX_API constexpr bool
397398
operator==(const hierarchy_dimensions_fragment& left, const hierarchy_dimensions_fragment& right) noexcept

cudax/include/cuda/experimental/__hierarchy/level_dimensions.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ struct level_dimensions
129129
_CCCL_HOST_DEVICE constexpr level_dimensions()
130130
: dims(){};
131131

132-
# if !defined(_CCCL_NO_THREE_WAY_COMPARISON)
133-
_CCCL_NODISCARD _CUDAX_API constexpr bool operator==(const level_dimensions&) const noexcept = default;
132+
# if !defined(_CCCL_NO_THREE_WAY_COMPARISON) && !_CCCL_COMPILER(MSVC, <, 19, 39)
133+
_CCCL_NODISCARD _CCCL_HIDE_FROM_ABI constexpr bool operator==(const level_dimensions&) const noexcept = default;
134134
# else // ^^^ !_CCCL_NO_THREE_WAY_COMPARISON ^^^ / vvv _CCCL_NO_THREE_WAY_COMPARISON vvv
135135
_CCCL_NODISCARD_FRIEND _CUDAX_API constexpr bool
136136
operator==(const level_dimensions& left, const level_dimensions& right) noexcept

cudax/include/cuda/experimental/__utility/basic_any/semiregular.cuh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ struct iequality_comparable : interface<iequality_comparable>
155155
#if !defined(_CCCL_NO_THREE_WAY_COMPARISON)
156156
_CCCL_NODISCARD _CUDAX_HOST_API auto operator==(iequality_comparable const& __other) const -> bool
157157
{
158-
auto const& __other = __cudax::basic_any_from(__other);
159-
void const* __obj = __basic_any_access::__get_optr(__other);
160-
return __cudax::virtcall<&__equal_fn<iequality_comparable>>(this, __other.type(), __obj);
158+
auto const& __rhs = __cudax::basic_any_from(__other);
159+
void const* __obj = __basic_any_access::__get_optr(__rhs);
160+
return __cudax::virtcall<&__equal_fn<iequality_comparable>>(this, __rhs.type(), __obj);
161161
}
162162
#else // ^^^ !_CCCL_NO_THREE_WAY_COMPARISON ^^^ / vvv _CCCL_NO_THREE_WAY_COMPARISON vvv
163163
_CCCL_NODISCARD_FRIEND _CUDAX_HOST_API auto

libcudacxx/include/cuda/std/__cccl/dialect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@
120120
#endif // _CCCL_STD_VER <= 2014 || __cpp_nontype_template_parameter_auto < 201606L
121121

122122
// Three way comparison is only available from C++20 onwards
123-
#if _CCCL_STD_VER <= 2017 || __cpp_three_way_comparison < 201907
123+
#if _CCCL_STD_VER <= 2017 || __cpp_impl_three_way_comparison < 201907L
124124
# define _CCCL_NO_THREE_WAY_COMPARISON
125-
#endif // _CCCL_STD_VER <= 2017 || __cpp_three_way_comparison < 201907
125+
#endif // _CCCL_STD_VER <= 2017 || __cpp_impl_three_way_comparison < 201907L
126126

127127
// Variable templates are only available from C++14 onwards and require some compiler support
128128
#if _CCCL_STD_VER <= 2011 || __cpp_variable_templates < 201304L

0 commit comments

Comments
 (0)