Skip to content

Commit

Permalink
Block type pack indexing on NVCC (#2563)
Browse files Browse the repository at this point in the history
* Block type indexing if the compiler is NVCC.

Co-authored-by: Michael Schellenberger Costa <[email protected]>
  • Loading branch information
wmaxey and miscco authored Oct 14, 2024
1 parent e86947f commit 2ba9597
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libcudacxx/include/cuda/std/__type_traits/type_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,19 @@ struct _CCCL_TYPE_VISIBILITY_DEFAULT __type_defer
{};

// Implementation for indexing into a list of types:
# if defined(__cpp_pack_indexing)
# if defined(__cpp_pack_indexing) && !defined(_CCCL_CUDA_COMPILER_NVCC)

_CCCL_DIAG_PUSH
_CCCL_DIAG_SUPPRESS_CLANG("-Wc++26-extensions")

template <size_t _Ip, class... _Ts>
using __type_index_c = _Ts...[_Ip];

template <class _Ip, class... _Ts>
using __type_index = _Ts...[_Ip::value];

_CCCL_DIAG_POP

// Versions of nvcc prior to 12.0 have trouble with pack expansion into
// __type_pack_element in an alias template, so we use the fall-back
// implementation instead.
Expand Down

0 comments on commit 2ba9597

Please sign in to comment.