From 12e109631611f2dfaa10a23d7506decf8158d958 Mon Sep 17 00:00:00 2001 From: pciolkosz Date: Mon, 20 May 2024 15:48:23 -0700 Subject: [PATCH] Fix incomplete class member access error in clang --- .../__hierarchy/hierarchy_dimensions.cuh | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/cudax/include/cuda/experimental/__hierarchy/hierarchy_dimensions.cuh b/cudax/include/cuda/experimental/__hierarchy/hierarchy_dimensions.cuh index b7e4e56a61..a56073ae88 100644 --- a/cudax/include/cuda/experimental/__hierarchy/hierarchy_dimensions.cuh +++ b/cudax/include/cuda/experimental/__hierarchy/hierarchy_dimensions.cuh @@ -14,6 +14,8 @@ #include #include +#include "cuda/std/__functional/invoke.h" +#include "cuda/std/__utility/declval.h" #include #if _CCCL_STD_VER >= 2017 @@ -371,9 +373,9 @@ struct hierarchy_dimensions_fragment {} private: - // TODO is this useful enough to expose? + // This being static is a bit of a hack to make extents_type working without incomplete class member access template - _CCCL_NODISCARD _CCCL_HOST_DEVICE constexpr auto levels_range() const noexcept + _CCCL_NODISCARD _CCCL_HOST_DEVICE static constexpr auto levels_range_static(const decltype(levels)& levels) noexcept { static_assert(has_level>); static_assert(has_level_or_unit>); @@ -381,6 +383,13 @@ private: return ::cuda::std::apply(detail::get_levels_range, levels); } + // TODO is this useful enough to expose? + template + _CCCL_NODISCARD _CCCL_HOST_DEVICE constexpr auto levels_range() const noexcept + { + return levels_range_static(levels); + } + template struct fragment_helper { @@ -393,9 +402,10 @@ private: public: template - using extents_type = decltype(::cuda::std::apply( - ::cuda::std::declval>(), - ::cuda::std::declval>().template levels_range())); + using extents_type = + decltype(::cuda::std::apply(::cuda::std::declval>(), + levels_range_static(::cuda::std::declval()))); + /** * @brief Get a fragment of this hierarchy * @@ -470,6 +480,13 @@ public: return detail::convert_to_query_result(::cuda::std::apply(detail::hierarchy_extents_helper{}, selected)); } + // template + // using extents_type = ::cuda::std::invoke_result_t< + // decltype(&hierarchy_dimensions_fragment::template extents), + // hierarchy_dimensions_fragment, + // Unit(), + // Level()>; + /** * @brief Returns a count of specified entities at a level in this hierarchy. *