Skip to content

Commit

Permalink
Fix error compiling tuple_size in clang 17.
Browse files Browse the repository at this point in the history
Clang complains:

  In file included from cuco/static_map.cuh:24:
  In file included from cuco/pair.cuh:147:
  In file included from cuco/detail/pair/pair.inl:54:
  cuco/detail/pair/tuple_helpers.inl:18:8: error:
        cannot specialize a dependent template
     18 | struct tuple_size<cuco::pair<T1, T2>> : integral_constant<size_t, 2> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:22:8: error:
        cannot specialize a dependent template
     22 | struct tuple_size<const cuco::pair<T1, T2>> : tuple_size<cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:26:8: error:
        cannot specialize a dependent template
     26 | struct tuple_size<volatile cuco::pair<T1, T2>> : tuple_size<cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:30:8: error:
        cannot specialize a dependent template
     30 | struct tuple_size<const volatile cuco::pair<T1, T2>> : tuple_size<cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:34:8: error:
        cannot specialize a dependent template
     34 | struct tuple_element<I, cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:39:8: error:
        cannot specialize a dependent template
     39 | struct tuple_element<0, cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:44:8: error:
        cannot specialize a dependent template
     44 | struct tuple_element<1, cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:49:8: error:
        cannot specialize a dependent template
     49 | struct tuple_element<0, const cuco::pair<T1, T2>> : tuple_element<0, cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:53:8: error:
        cannot specialize a dependent template
     53 | struct tuple_element<1, const cuco::pair<T1, T2>> : tuple_element<1, cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:57:8: error:
        cannot specialize a dependent template
     57 | struct tuple_element<0, volatile cuco::pair<T1, T2>> : tuple_element<0, cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:61:8: error:
        cannot specialize a dependent template
     61 | struct tuple_element<1, volatile cuco::pair<T1, T2>> : tuple_element<1, cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:65:8: error:
        cannot specialize a dependent template
     65 | struct tuple_element<0, const volatile cuco::pair<T1, T2>> : tuple_element<0, cuco::pair<T1, T2>> {
        |        ^
  cuco/detail/pair/tuple_helpers.inl:69:8: error:
        cannot specialize a dependent template
     69 | struct tuple_element<1, const volatile cuco::pair<T1, T2>> : tuple_element<1, cuco::pair<T1, T2>> {
        |        ^

If we dig in, include/cuco/detail/pair/pair.inl is trying to teach
tuple_size and tuple_element to work with cuco::pair's.

thrust/pair.h defines thrust::tuple_size to be:

  template <class T>
  using tuple_size = ::cuda::std::tuple_size<T>;

This is a using statement, not a class.  So, we only need to teach
cuda::std::{tuple_size, tuple_element} how to work with cuco::pair, not
thrust::{tuple_size, tuple_element}.

Signed-off-by: Austin Schuh <[email protected]>
  • Loading branch information
AustinSchuh committed Nov 16, 2023
1 parent 4ddb149 commit fdfea05
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions include/cuco/detail/pair/pair.inl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ __host__ __device__ constexpr bool operator==(cuco::pair<T1, T2> const& lhs,

} // namespace cuco

namespace thrust {
#include <cuco/detail/pair/tuple_helpers.inl>
} // namespace thrust

namespace cuda::std {
#include <cuco/detail/pair/tuple_helpers.inl>
} // namespace cuda::std

0 comments on commit fdfea05

Please sign in to comment.