From e468538380155e8dcd6ce0e2d78b37dc8e724f2b Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 10 Sep 2024 20:23:06 +0000 Subject: [PATCH] nvrtc wants `integral_constant`'s functions host/device annotated --- .../include/cuda/std/__type_traits/integral_constant.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libcudacxx/include/cuda/std/__type_traits/integral_constant.h b/libcudacxx/include/cuda/std/__type_traits/integral_constant.h index e73407aeb4..e4b346d396 100644 --- a/libcudacxx/include/cuda/std/__type_traits/integral_constant.h +++ b/libcudacxx/include/cuda/std/__type_traits/integral_constant.h @@ -28,20 +28,24 @@ struct _CCCL_TYPE_VISIBILITY_DEFAULT integral_constant static constexpr const _Tp value = __v; typedef _Tp value_type; typedef integral_constant type; - _LIBCUDACXX_HIDE_FROM_ABI constexpr operator value_type() const noexcept + _CCCL_HOST_DEVICE _LIBCUDACXX_HIDE_FROM_ABI constexpr operator value_type() const noexcept { return value; } #if _CCCL_STD_VER > 2011 - _LIBCUDACXX_HIDE_FROM_ABI constexpr value_type operator()() const noexcept + _CCCL_HOST_DEVICE _LIBCUDACXX_HIDE_FROM_ABI constexpr value_type operator()() const noexcept { return value; } #endif }; +// Before the addition of inline variables, it was necessary to +// provide a definition for constexpr class static data members. +#if _CCCL_STD_VER >= 2017 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) template constexpr const _Tp integral_constant<_Tp, __v>::value; +#endif typedef integral_constant true_type; typedef integral_constant false_type;