-
Notifications
You must be signed in to change notification settings - Fork 405
Constrain tuple_of_iterator_references -> tuple conversion on element convertibility (fixes GCC 9 build break) #9284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,7 +168,12 @@ class tuple_of_iterator_references : public ::cuda::std::tuple<Ts...> | |
|
|
||
| template < | ||
| class... Us, | ||
| ::cuda::std::enable_if_t<is_compatible_tuple_v<::cuda::std::tuple<Us...>, ::cuda::std::tuple<Ts...>>, int> = 0> | ||
| ::cuda::std::enable_if_t<is_compatible_tuple_v<::cuda::std::tuple<Us...>, ::cuda::std::tuple<Ts...>>, int> = 0, | ||
| // Structure compatibility alone is not enough: each held reference must actually convert to the | ||
| // requested element, otherwise this operator is selected for ill-formed conversions such as | ||
| // tuple_of_iterator_references<const int&> -> tuple<int&>, which then hard-errors in the body | ||
| // (e.g. during a contiguous_iterator concept check on a zip_iterator under GCC 9). | ||
| ::cuda::std::enable_if_t<(::cuda::std::is_convertible_v<Ts, Us> && ...), int> = 0> | ||
| _CCCL_HOST_DEVICE constexpr operator ::cuda::std::tuple<Us...>() const | ||
|
Comment on lines
169
to
177
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE="thrust/thrust/iterator/detail/tuple_of_iterator_references.h"
echo "== Includes in $FILE =="
sed -n '1,120p' "$FILE" | nl -ba | sed -n '1,120p'
echo
echo "== Search for is_convertible_v =="
rg -n "::cuda::std::is_convertible_v" "$FILE"
echo
echo "== Show surrounding code for the operator constraints =="
sed -n '140,220p' "$FILE" | nl -baRepository: NVIDIA/cccl Length of output: 195 🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE="thrust/thrust/iterator/detail/tuple_of_iterator_references.h"
echo "== Top of file (includes) =="
sed -n '1,80p' "$FILE" | cat -n
echo
echo "== Search for is_convertible_v =="
rg -n "::cuda::std::is_convertible_v" "$FILE" || true
echo
echo "== Surrounding code (lines ~140-220) =="
sed -n '140,220p' "$FILE" | cat -nRepository: NVIDIA/cccl Length of output: 6797 🏁 Script executed: #!/bin/bash
set -euo pipefail
# 1) Confirm where is_convertible_v is defined
rg -n "is_convertible_v" libcudacxx cuda 2>/dev/null | head -n 50
# 2) Find the specific header that defines it (search by filename + symbol)
fd "is_convertible" -a . 2>/dev/null | head -n 50
# 3) Inspect that header's contents around the definition
H=$(fd "is_convertible.h" -a . 2>/dev/null | head -n 1 || true)
echo "First match for is_convertible.h: $H"
if [ -n "${H:-}" ]; then
sed -n '1,120p' "$H" | cat -n
rg -n "is_convertible_v" "$H" || true
fi
# 4) Check whether already-included headers include is_convertible.h
INCLUDES=(
"cuda/std/__type_traits/common_reference.h"
"cuda/std/__type_traits/enable_if.h"
)
for inc in "${INCLUDES[@]}"; do
f=$(fd "$(basename "$inc")" cuda libcudacxx 2>/dev/null | head -n 1 || true)
echo "Resolved $inc -> $f"
if [ -n "${f:-}" ]; then
rg -n "`#include` <cuda/std/__type_traits/is_convertible.h>" "$f" || true
rg -n "is_convertible" "$f" | head -n 20 || true
fi
doneRepository: NVIDIA/cccl Length of output: 7578 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect common_reference.h and enable_if.h for is_convertible includes
for f in \
"libcudacxx/include/cuda/std/__type_traits/common_reference.h" \
"libcudacxx/include/cuda/std/__type_traits/enable_if.h" \
"libcudacxx/include/cuda/std/__tuple_dir/tuple_constraints.h" \
"libcudacxx/include/cuda/std/__tuple_dir/tuple_element.h" \
"libcudacxx/include/cuda/std/tuple"; do
if [ -f "$f" ]; then
echo "==== $f (top includes) ===="
sed -n '1,120p' "$f" | cat -n
echo
rg -n "`#include` <cuda/std/__type_traits/is_convertible.h>" "$f" || true
echo
fi
doneRepository: NVIDIA/cccl Length of output: 18739 suggestion: Proposed diff `#include` <cuda/std/__type_traits/common_reference.h>
`#include` <cuda/std/__type_traits/enable_if.h>
+#include <cuda/std/__type_traits/is_convertible.h>
`#include` <cuda/std/__utility/move.h>Source: Coding guidelines |
||
| { | ||
| return __to_tuple<Us...>(typename ::cuda::std::__make_tuple_indices<sizeof...(Ts)>::type{}); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: NVIDIA/cccl
Length of output: 5434
🏁 Script executed:
Repository: NVIDIA/cccl
Length of output: 219
🏁 Script executed:
Repository: NVIDIA/cccl
Length of output: 3404
🏁 Script executed:
Repository: NVIDIA/cccl
Length of output: 175
🏁 Script executed:
Repository: NVIDIA/cccl
Length of output: 6378
suggestion: Add a direct include for
declvalinlibcudacxx/include/cuda/std/__tuple_dir/tuple.hsince__tuple_of_iterator_references_constructible_vuses::cuda::std::declval; the current build relies on a transitive include viatuple_constraints.h.diff
`#include` <cuda/std/__utility/forward.h> +#include <cuda/std/__utility/declval.h> `#include` <cuda/std/__utility/move.h>Source: Coding guidelines