Skip to content

Commit

Permalink
Fix incomplete class member access error in clang
Browse files Browse the repository at this point in the history
  • Loading branch information
pciolkosz committed May 20, 2024
1 parent 93eed09 commit 12e1096
Showing 1 changed file with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <cuda/experimental/__hierarchy/level_dimensions.cuh>
#include <cuda/std/tuple>

#include "cuda/std/__functional/invoke.h"
#include "cuda/std/__utility/declval.h"
#include <nv/target>

#if _CCCL_STD_VER >= 2017
Expand Down Expand Up @@ -371,16 +373,23 @@ 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 <typename Unit, typename Level>
_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<Level, hierarchy_dimensions_fragment<BottomUnit, Levels...>>);
static_assert(has_level_or_unit<Unit, hierarchy_dimensions_fragment<BottomUnit, Levels...>>);
static_assert(detail::legal_unit_for_level<Unit, Level>);
return ::cuda::std::apply(detail::get_levels_range<Level, Unit, Levels...>, levels);
}

// TODO is this useful enough to expose?
template <typename Unit, typename Level>
_CCCL_NODISCARD _CCCL_HOST_DEVICE constexpr auto levels_range() const noexcept
{
return levels_range_static<Unit, Level>(levels);
}

template <typename Unit>
struct fragment_helper
{
Expand All @@ -393,9 +402,10 @@ private:

public:
template <typename Unit, typename Level>
using extents_type = decltype(::cuda::std::apply(
::cuda::std::declval<detail::hierarchy_extents_helper<Unit>>(),
::cuda::std::declval<hierarchy_dimensions_fragment<BottomUnit, Levels...>>().template levels_range<Unit, Level>()));
using extents_type =
decltype(::cuda::std::apply(::cuda::std::declval<detail::hierarchy_extents_helper<Unit>>(),
levels_range_static<Unit, Level>(::cuda::std::declval<decltype(levels)>())));

/**
* @brief Get a fragment of this hierarchy
*
Expand Down Expand Up @@ -470,6 +480,13 @@ public:
return detail::convert_to_query_result(::cuda::std::apply(detail::hierarchy_extents_helper<Unit>{}, selected));
}

// template <typename Unit, typename Level>
// using extents_type = ::cuda::std::invoke_result_t<
// decltype(&hierarchy_dimensions_fragment<BottomUnit, Levels...>::template extents<Unit, Level>),
// hierarchy_dimensions_fragment<BottomUnit, Levels...>,
// Unit(),
// Level()>;

/**
* @brief Returns a count of specified entities at a level in this hierarchy.
*
Expand Down

0 comments on commit 12e1096

Please sign in to comment.