Skip to content

Commit

Permalink
add a config macro for testing support for inline variables (#2581)
Browse files Browse the repository at this point in the history
* add a config macro for testing support for inline variables

* Drop `_LIBCUDACXX_` macros

* Use a consistent macro for enabling variable templates

* Move it in repo.toml

---------

Co-authored-by: Michael Schellenberger Costa <[email protected]>
  • Loading branch information
ericniebler and miscco authored Oct 15, 2024
1 parent 5e1c74f commit e5229f2
Show file tree
Hide file tree
Showing 129 changed files with 591 additions and 614 deletions.
4 changes: 2 additions & 2 deletions cub/cub/device/dispatch/dispatch_merge.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ namespace detail
{
namespace merge
{
_LIBCUDACXX_INLINE_VAR constexpr int fallback_BLOCK_THREADS = 64;
_LIBCUDACXX_INLINE_VAR constexpr int fallback_ITEMS_PER_THREAD = 1;
_CCCL_INLINE_VAR constexpr int fallback_BLOCK_THREADS = 64;
_CCCL_INLINE_VAR constexpr int fallback_ITEMS_PER_THREAD = 1;

template <typename DefaultPolicy, class... Args>
class choose_merge_agent
Expand Down
2 changes: 1 addition & 1 deletion cub/cub/util_type.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ struct CubVector
};

/// The maximum number of elements in CUDA vector types
_LIBCUDACXX_INLINE_VAR constexpr int MAX_VEC_ELEMENTS = 4;
_CCCL_INLINE_VAR constexpr int MAX_VEC_ELEMENTS = 4;

/**
* Generic vector-1 type
Expand Down
2 changes: 1 addition & 1 deletion cub/test/catch2_test_launch_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

#define DECLARE_LAUNCH_WRAPPER(API, WRAPPED_API_NAME) \
DECLARE_INVOCABLE(API, WRAPPED_API_NAME, , ); \
_LIBCUDACXX_INLINE_VAR constexpr struct WRAPPED_API_NAME##_t \
_CCCL_INLINE_VAR constexpr struct WRAPPED_API_NAME##_t \
{ \
template <class... As> \
void operator()(As... args) const \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ struct get_level_helper
} // namespace detail

template <typename QueryLevel, typename Hierarchy>
_LIBCUDACXX_INLINE_VAR constexpr bool has_level =
_CCCL_INLINE_VAR constexpr bool has_level =
detail::has_level_helper<QueryLevel, ::cuda::std::remove_cv_t<::cuda::std::remove_reference_t<Hierarchy>>>::value;

template <typename QueryLevel, typename Hierarchy>
_LIBCUDACXX_INLINE_VAR constexpr bool has_level_or_unit =
_CCCL_INLINE_VAR constexpr bool has_level_or_unit =
detail::has_level_helper<QueryLevel, ::cuda::std::remove_cv_t<::cuda::std::remove_reference_t<Hierarchy>>>::value
|| detail::has_unit<QueryLevel, ::cuda::std::remove_cv_t<::cuda::std::remove_reference_t<Hierarchy>>>::value;

Expand Down
10 changes: 5 additions & 5 deletions cudax/include/cuda/experimental/__hierarchy/hierarchy_levels.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,22 @@ struct allowed_levels<>
namespace detail
{
template <typename QueryLevel, typename AllowedLevels>
_LIBCUDACXX_INLINE_VAR constexpr bool is_level_allowed = false;
_CCCL_INLINE_VAR constexpr bool is_level_allowed = false;

template <typename QueryLevel, typename... Levels>
_LIBCUDACXX_INLINE_VAR constexpr bool is_level_allowed<QueryLevel, allowed_levels<Levels...>> =
_CCCL_INLINE_VAR constexpr bool is_level_allowed<QueryLevel, allowed_levels<Levels...>> =
::cuda::std::disjunction_v<::cuda::std::is_same<QueryLevel, Levels>...>;

template <typename L1, typename L2>
_LIBCUDACXX_INLINE_VAR constexpr bool can_stack_on_top =
_CCCL_INLINE_VAR constexpr bool can_stack_on_top =
is_level_allowed<L1, typename L2::allowed_below> || is_level_allowed<L2, typename L1::allowed_above>;

template <typename Unit, typename Level>
_LIBCUDACXX_INLINE_VAR constexpr bool legal_unit_for_level =
_CCCL_INLINE_VAR constexpr bool legal_unit_for_level =
can_stack_on_top<Unit, Level> || legal_unit_for_level<Unit, typename Level::allowed_below::default_unit>;

template <typename Unit>
_LIBCUDACXX_INLINE_VAR constexpr bool legal_unit_for_level<Unit, void> = false;
_CCCL_INLINE_VAR constexpr bool legal_unit_for_level<Unit, void> = false;
} // namespace detail

// Base type for all hierarchy levels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
namespace cuda::experimental::mr
{
template <class _Ty, class _Uy = _CUDA_VSTD::remove_cvref_t<_Ty>>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_basic_any_resource = false;
_CCCL_INLINE_VAR constexpr bool __is_basic_any_resource = false;

//! @rst
//! .. _cudax-memory-resource-basic-any-resource:
Expand Down Expand Up @@ -279,8 +279,7 @@ public:

//! @brief Checks whether a passed in type is a specialization of basic_any_resource
template <class _Ty, _CUDA_VMR::_AllocType _Alloc_type, class... _Properties>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_basic_any_resource<_Ty, basic_any_resource<_Alloc_type, _Properties...>> =
true;
_CCCL_INLINE_VAR constexpr bool __is_basic_any_resource<_Ty, basic_any_resource<_Alloc_type, _Properties...>> = true;

//! @rst
//! .. _cudax-memory-resource-any-resource:
Expand Down
2 changes: 1 addition & 1 deletion docs/repo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ doxygen_predefined = [
"_CCCL_HOST=",
"_CCCL_HOST_DEVICE=",
"_CCCL_IF_CONSTEXPR=if constexpr",
"_CCCL_INLINE_VAR=inline",
"_CCCL_NODISCARD=[[nodiscard]]",
"_CCCL_NODISCARD_FRIEND=",
"_CCCL_STD_VER=2020",
Expand All @@ -406,7 +407,6 @@ doxygen_predefined = [
"_LIBCUDACXX_AND=&&",
"_LIBCUDACXX_EAT_REST(x)=",
"_LIBCUDACXX_GLOBAL_CONSTANT=inline",
"_LIBCUDACXX_INLINE_VAR=inline",
"_LIBCUDACXX_REQUIRES(x)= ::cuda::std::__enable_if_t<x, int> = 0>",
"_LIBCUDACXX_TEMPLATE(x)=template<x, ",
"_LIBCUDACXX_TRAILING_REQUIRES(x)=-> x _LIBCUDACXX_EAT_REST",
Expand Down
8 changes: 4 additions & 4 deletions libcudacxx/include/cuda/__memory_resource/get_property.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ _LIBCUDACXX_BEGIN_NAMESPACE_CUDA
//!
//! @endrst
template <class _Resource, class _Property, class = void>
_LIBCUDACXX_INLINE_VAR constexpr bool has_property = false;
_CCCL_INLINE_VAR constexpr bool has_property = false;

template <class _Resource, class _Property>
_LIBCUDACXX_INLINE_VAR constexpr bool has_property<
_CCCL_INLINE_VAR constexpr bool has_property<
_Resource,
_Property,
_CUDA_VSTD::void_t<decltype(get_property(_CUDA_VSTD::declval<const _Resource&>(), _CUDA_VSTD::declval<_Property>()))>> =
Expand All @@ -67,10 +67,10 @@ using __property_value_t = typename _Property::value_type;
//!
//! @endrst
template <class _Property, class = void>
_LIBCUDACXX_INLINE_VAR constexpr bool property_with_value = false;
_CCCL_INLINE_VAR constexpr bool property_with_value = false;

template <class _Property>
_LIBCUDACXX_INLINE_VAR constexpr bool property_with_value<_Property, _CUDA_VSTD::void_t<__property_value_t<_Property>>> =
_CCCL_INLINE_VAR constexpr bool property_with_value<_Property, _CUDA_VSTD::void_t<__property_value_t<_Property>>> =
true;

//! @brief The \c has_property_with concept verifies that a Resource satisfies a given stateful Property
Expand Down
12 changes: 6 additions & 6 deletions libcudacxx/include/cuda/__memory_resource/properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
_LIBCUDACXX_BEGIN_NAMESPACE_CUDA_MR

//! @brief The default alignment by a cudaMalloc{...} call
_LIBCUDACXX_INLINE_VAR constexpr size_t default_cuda_malloc_alignment = 256;
_CCCL_INLINE_VAR constexpr size_t default_cuda_malloc_alignment = 256;

//! @brief The default alignment by a cudaMallocHost{...} call
_LIBCUDACXX_INLINE_VAR constexpr size_t default_cuda_malloc_host_alignment = alignof(_CUDA_VSTD::max_align_t);
_CCCL_INLINE_VAR constexpr size_t default_cuda_malloc_host_alignment = alignof(_CUDA_VSTD::max_align_t);

//! @brief The device_accessible property signals that the allocated memory is device accessible
struct device_accessible
Expand All @@ -46,22 +46,22 @@ struct host_accessible

//! @brief determines wether a set of properties signals host accessible memory.
template <class... _Properties>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_host_accessible =
_CCCL_INLINE_VAR constexpr bool __is_host_accessible =
_CUDA_VSTD::__type_set_contains<_CUDA_VSTD::__make_type_set<_Properties...>, host_accessible>;

//! @brief determines wether a set of properties signals device accessible memory.
template <class... _Properties>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_device_accessible =
_CCCL_INLINE_VAR constexpr bool __is_device_accessible =
_CUDA_VSTD::__type_set_contains<_CUDA_VSTD::__make_type_set<_Properties...>, device_accessible>;

//! @brief determines wether a set of properties signals host device accessible memory.
template <class... _Properties>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_host_device_accessible =
_CCCL_INLINE_VAR constexpr bool __is_host_device_accessible =
_CUDA_VSTD::__type_set_contains<_CUDA_VSTD::__make_type_set<_Properties...>, host_accessible, device_accessible>;

//! @brief verifies that a set of properties contains at least one execution space property
template <class... _Properties>
_LIBCUDACXX_INLINE_VAR constexpr bool __contains_execution_space_property =
_CCCL_INLINE_VAR constexpr bool __contains_execution_space_property =
__is_host_accessible<_Properties...> || __is_device_accessible<_Properties...>;

_LIBCUDACXX_END_NAMESPACE_CUDA_MR
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/__memory_resource/resource_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ template <_AllocType _Alloc_type>
using _Vtable_store = _CUDA_VSTD::_If<_Alloc_type == _AllocType::_Default, _Alloc_vtable, _Async_alloc_vtable>;

template <_AllocType _Alloc_type, _WrapperType _Wrapper_type, class _Resource>
_LIBCUDACXX_INLINE_VAR constexpr _Vtable_store<_Alloc_type> __alloc_vtable =
_CCCL_INLINE_VAR constexpr _Vtable_store<_Alloc_type> __alloc_vtable =
_Resource_vtable_builder::template _Create<_Resource, _Alloc_type, _Wrapper_type>();

struct _Resource_ref_helper
Expand Down
12 changes: 6 additions & 6 deletions libcudacxx/include/cuda/std/__atomic/order.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ _LIBCUDACXX_BEGIN_NAMESPACE_CUDA

using memory_order = _CUDA_VSTD::memory_order;

_LIBCUDACXX_INLINE_VAR constexpr memory_order memory_order_relaxed = _CUDA_VSTD::memory_order_relaxed;
_LIBCUDACXX_INLINE_VAR constexpr memory_order memory_order_consume = _CUDA_VSTD::memory_order_consume;
_LIBCUDACXX_INLINE_VAR constexpr memory_order memory_order_acquire = _CUDA_VSTD::memory_order_acquire;
_LIBCUDACXX_INLINE_VAR constexpr memory_order memory_order_release = _CUDA_VSTD::memory_order_release;
_LIBCUDACXX_INLINE_VAR constexpr memory_order memory_order_acq_rel = _CUDA_VSTD::memory_order_acq_rel;
_LIBCUDACXX_INLINE_VAR constexpr memory_order memory_order_seq_cst = _CUDA_VSTD::memory_order_seq_cst;
_CCCL_INLINE_VAR constexpr memory_order memory_order_relaxed = _CUDA_VSTD::memory_order_relaxed;
_CCCL_INLINE_VAR constexpr memory_order memory_order_consume = _CUDA_VSTD::memory_order_consume;
_CCCL_INLINE_VAR constexpr memory_order memory_order_acquire = _CUDA_VSTD::memory_order_acquire;
_CCCL_INLINE_VAR constexpr memory_order memory_order_release = _CUDA_VSTD::memory_order_release;
_CCCL_INLINE_VAR constexpr memory_order memory_order_acq_rel = _CUDA_VSTD::memory_order_acq_rel;
_CCCL_INLINE_VAR constexpr memory_order memory_order_seq_cst = _CUDA_VSTD::memory_order_seq_cst;

_LIBCUDACXX_END_NAMESPACE_CUDA

Expand Down
8 changes: 7 additions & 1 deletion libcudacxx/include/cuda/std/__cccl/dialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,16 @@
// Inline variables are only available from C++17 onwards
#if _CCCL_STD_VER >= 2017 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L)
# define _CCCL_INLINE_VAR inline
#else // ^^^ C++14 ^^^ / vvv C++17 vvv
#else // ^^^ C++17 ^^^ / vvv C++14 vvv
# define _CCCL_NO_INLINE_VARIABLES
# define _CCCL_INLINE_VAR
#endif // _CCCL_STD_VER <= 2014

// Variable templates are only available from C++14 onwards and require some compiler support
#if _CCCL_STD_VER <= 2011 || !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304L)
# define _CCCL_NO_VARIABLE_TEMPALTES
#endif // _CCCL_STD_VER <= 2011

// We need to treat host and device separately
#if defined(__CUDA_ARCH__)
# define _CCCL_GLOBAL_CONSTANT _CCCL_DEVICE _CCCL_CONSTEXPR_GLOBAL
Expand Down
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/std/__concepts/__concept_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@

# else

# define _LIBCUDACXX_CONCEPT _LIBCUDACXX_INLINE_VAR constexpr bool
# define _LIBCUDACXX_CONCEPT _CCCL_INLINE_VAR constexpr bool

# define _LIBCUDACXX_CONCEPT_FRAGMENT(_NAME, ...) \
_LIBCUDACXX_HIDE_FROM_ABI auto _NAME##_LIBCUDACXX_CONCEPT_FRAGMENT_impl_ \
Expand Down Expand Up @@ -356,7 +356,7 @@ _LIBCUDACXX_HIDE_FROM_ABI _Concept::_Enable_if_t<_Bp> _Requires()
{}
# else
template <bool _Bp, _Concept::_Enable_if_t<_Bp, int> = 0>
_LIBCUDACXX_INLINE_VAR constexpr int _Requires = 0;
_CCCL_INLINE_VAR constexpr int _Requires = 0;
# endif
} // namespace _Concept

Expand Down
18 changes: 9 additions & 9 deletions libcudacxx/include/cuda/std/__concepts/destructible.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@ _LIBCUDACXX_CONCEPT destructible = __is_nothrow_destructible(_Tp);
# else // ^^^ _CCCL_COMPILER_MSVC ^^^ / vvv !_CCCL_COMPILER_MSVC vvv

template <class _Tp, class = void, class = void>
_LIBCUDACXX_INLINE_VAR constexpr bool __destructible_impl = false;
_CCCL_INLINE_VAR constexpr bool __destructible_impl = false;

template <class _Tp>
_LIBCUDACXX_INLINE_VAR constexpr bool __destructible_impl<_Tp,
__enable_if_t<_CCCL_TRAIT(is_object, _Tp)>,
_CCCL_INLINE_VAR constexpr bool __destructible_impl<_Tp,
__enable_if_t<_CCCL_TRAIT(is_object, _Tp)>,
# if defined(_CCCL_COMPILER_GCC)
__enable_if_t<_CCCL_TRAIT(is_destructible, _Tp)>>
__enable_if_t<_CCCL_TRAIT(is_destructible, _Tp)>>
# else // ^^^ _CCCL_COMPILER_GCC ^^^ / vvv !_CCCL_COMPILER_GCC vvv
void_t<decltype(_CUDA_VSTD::declval<_Tp>().~_Tp())>>
void_t<decltype(_CUDA_VSTD::declval<_Tp>().~_Tp())>>
# endif // !_CCCL_COMPILER_GCC
= noexcept(_CUDA_VSTD::declval<_Tp>().~_Tp());

template <class _Tp>
_LIBCUDACXX_INLINE_VAR constexpr bool __destructible = __destructible_impl<_Tp>;
_CCCL_INLINE_VAR constexpr bool __destructible = __destructible_impl<_Tp>;

template <class _Tp>
_LIBCUDACXX_INLINE_VAR constexpr bool __destructible<_Tp&> = true;
_CCCL_INLINE_VAR constexpr bool __destructible<_Tp&> = true;

template <class _Tp>
_LIBCUDACXX_INLINE_VAR constexpr bool __destructible<_Tp&&> = true;
_CCCL_INLINE_VAR constexpr bool __destructible<_Tp&&> = true;

template <class _Tp, size_t _Nm>
_LIBCUDACXX_INLINE_VAR constexpr bool __destructible<_Tp[_Nm]> = __destructible<_Tp>;
_CCCL_INLINE_VAR constexpr bool __destructible<_Tp[_Nm]> = __destructible<_Tp>;

template <class _Tp>
_LIBCUDACXX_CONCEPT destructible = __destructible<_Tp>;
Expand Down
8 changes: 4 additions & 4 deletions libcudacxx/include/cuda/std/__concepts/swappable.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ _CCCL_NV_DIAG_DEFAULT(2642)

# else
template <class _Tp, class _Up, size_t _Size, class = void>
_LIBCUDACXX_INLINE_VAR constexpr bool __swappable_arrays = false;
_CCCL_INLINE_VAR constexpr bool __swappable_arrays = false;
# endif // _CCCL_STD_VER < 2020 || defined(_CCCL_COMPILER_NVHPC)

template <class _Tp, class _Up, class = void>
_LIBCUDACXX_INLINE_VAR constexpr bool __noexcept_swappable_arrays = false;
_CCCL_INLINE_VAR constexpr bool __noexcept_swappable_arrays = false;

struct __fn
{
Expand Down Expand Up @@ -146,12 +146,12 @@ _LIBCUDACXX_CONCEPT_FRAGMENT(
(__swap(__t[0], __u[0]))));

template <class _Tp, class _Up, size_t _Size>
_LIBCUDACXX_INLINE_VAR constexpr bool __swappable_arrays<_Tp, _Up, _Size, void_t<type_identity_t<_Tp>>> =
_CCCL_INLINE_VAR constexpr bool __swappable_arrays<_Tp, _Up, _Size, void_t<type_identity_t<_Tp>>> =
_LIBCUDACXX_FRAGMENT(__swappable_arrays_, _Tp, _Up, _CUDA_VSTD::integral_constant<size_t, _Size>);
# endif // _CCCL_STD_VER < 2020 || defined(_CCCL_COMPILER_NVHPC)

template <class _Tp, class _Up>
_LIBCUDACXX_INLINE_VAR constexpr bool __noexcept_swappable_arrays<_Tp, _Up, void_t<type_identity_t<_Tp>>> =
_CCCL_INLINE_VAR constexpr bool __noexcept_swappable_arrays<_Tp, _Up, void_t<type_identity_t<_Tp>>> =
noexcept(__swap::__fn{}(_CUDA_VSTD::declval<_Tp&>(), _CUDA_VSTD::declval<_Up&>()));

_LIBCUDACXX_END_NAMESPACE_CPO
Expand Down
14 changes: 7 additions & 7 deletions libcudacxx/include/cuda/std/__expected/expected.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,31 @@ class expected;
namespace __expected
{
template <class _Tp, class _Err>
_LIBCUDACXX_INLINE_VAR constexpr bool __valid_expected =
_CCCL_INLINE_VAR constexpr bool __valid_expected =
!_CCCL_TRAIT(is_reference, _Tp) && !_CCCL_TRAIT(is_function, _Tp)
&& !_CCCL_TRAIT(is_same, __remove_cv_t<_Tp>, in_place_t) && !_CCCL_TRAIT(is_same, __remove_cv_t<_Tp>, unexpect_t)
&& !__unexpected::__is_unexpected<__remove_cv_t<_Tp>> && __unexpected::__valid_unexpected<_Err>;

template <class _Tp>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_expected = false;
_CCCL_INLINE_VAR constexpr bool __is_expected = false;

template <class _Tp, class _Err>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_expected<expected<_Tp, _Err>> = true;
_CCCL_INLINE_VAR constexpr bool __is_expected<expected<_Tp, _Err>> = true;

template <class _Tp>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_expected_nonvoid = __is_expected<_Tp>;
_CCCL_INLINE_VAR constexpr bool __is_expected_nonvoid = __is_expected<_Tp>;

template <class _Err>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_expected_nonvoid<expected<void, _Err>> = false;
_CCCL_INLINE_VAR constexpr bool __is_expected_nonvoid<expected<void, _Err>> = false;

template <class _Tp, class _Err>
_LIBCUDACXX_INLINE_VAR constexpr bool __can_swap =
_CCCL_INLINE_VAR constexpr bool __can_swap =
_CCCL_TRAIT(is_swappable, _Tp) && _CCCL_TRAIT(is_swappable, _Err) && _CCCL_TRAIT(is_move_constructible, _Tp)
&& _CCCL_TRAIT(is_move_constructible, _Err)
&& (_CCCL_TRAIT(is_nothrow_move_constructible, _Tp) || _CCCL_TRAIT(is_nothrow_move_constructible, _Err));

template <class _Err>
_LIBCUDACXX_INLINE_VAR constexpr bool __can_swap<void, _Err> =
_CCCL_INLINE_VAR constexpr bool __can_swap<void, _Err> =
_CCCL_TRAIT(is_swappable, _Err) && _CCCL_TRAIT(is_move_constructible, _Err);
} // namespace __expected

Expand Down
8 changes: 4 additions & 4 deletions libcudacxx/include/cuda/std/__expected/expected_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ struct __expected_storage : __expected_destruct<_Tp, _Err>
};

template <class _Tp, class _Err>
_LIBCUDACXX_INLINE_VAR constexpr __smf_availability __expected_can_copy_construct =
_CCCL_INLINE_VAR constexpr __smf_availability __expected_can_copy_construct =
(_CCCL_TRAIT(is_trivially_copy_constructible, _Tp) || _CCCL_TRAIT(is_same, _Tp, void))
&& _CCCL_TRAIT(is_trivially_copy_constructible, _Err)
? __smf_availability::__trivial
Expand Down Expand Up @@ -567,7 +567,7 @@ struct __expected_copy<_Tp, _Err, __smf_availability::__deleted> : __expected_st
};

template <class _Tp, class _Err>
_LIBCUDACXX_INLINE_VAR constexpr __smf_availability __expected_can_move_construct =
_CCCL_INLINE_VAR constexpr __smf_availability __expected_can_move_construct =
(_CCCL_TRAIT(is_trivially_move_constructible, _Tp) || _CCCL_TRAIT(is_same, _Tp, void))
&& _CCCL_TRAIT(is_trivially_move_constructible, _Err)
? __smf_availability::__trivial
Expand Down Expand Up @@ -620,7 +620,7 @@ struct __expected_move<_Tp, _Err, __smf_availability::__deleted> : __expected_co

// Need to also check against is_nothrow_move_constructible in the trivial case as that is stupidly in the constraints
template <class _Tp, class _Err>
_LIBCUDACXX_INLINE_VAR constexpr __smf_availability __expected_can_copy_assign =
_CCCL_INLINE_VAR constexpr __smf_availability __expected_can_copy_assign =
(_CCCL_TRAIT(is_trivially_destructible, _Tp) || _CCCL_TRAIT(is_same, _Tp, void))
&& _CCCL_TRAIT(is_trivially_destructible, _Err)
&& (_CCCL_TRAIT(is_trivially_copy_constructible, _Tp) || _CCCL_TRAIT(is_same, _Tp, void))
Expand Down Expand Up @@ -695,7 +695,7 @@ struct __expected_copy_assign<_Tp, _Err, __smf_availability::__deleted> : __expe
};

template <class _Tp, class _Err>
_LIBCUDACXX_INLINE_VAR constexpr __smf_availability __expected_can_move_assign =
_CCCL_INLINE_VAR constexpr __smf_availability __expected_can_move_assign =
(_CCCL_TRAIT(is_trivially_destructible, _Tp) || _CCCL_TRAIT(is_same, _Tp, void))
&& _CCCL_TRAIT(is_trivially_destructible, _Err)
&& (_CCCL_TRAIT(is_trivially_move_constructible, _Tp) || _CCCL_TRAIT(is_same, _Tp, void))
Expand Down
6 changes: 3 additions & 3 deletions libcudacxx/include/cuda/std/__expected/unexpected.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ class unexpected;
namespace __unexpected
{
template <class _Tp>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_unexpected = false;
_CCCL_INLINE_VAR constexpr bool __is_unexpected = false;

template <class _Err>
_LIBCUDACXX_INLINE_VAR constexpr bool __is_unexpected<unexpected<_Err>> = true;
_CCCL_INLINE_VAR constexpr bool __is_unexpected<unexpected<_Err>> = true;

template <class _Tp>
_LIBCUDACXX_INLINE_VAR constexpr bool __valid_unexpected =
_CCCL_INLINE_VAR constexpr bool __valid_unexpected =
_CCCL_TRAIT(is_object, _Tp) && !_CCCL_TRAIT(is_array, _Tp) && !__is_unexpected<_Tp> && !_CCCL_TRAIT(is_const, _Tp)
&& !_CCCL_TRAIT(is_volatile, _Tp);
} // namespace __unexpected
Expand Down
Loading

0 comments on commit e5229f2

Please sign in to comment.