Open fbusato opened 1 week ago
Compile-time Error
libcu++
is_common_type does not work as expected when mixing rvalue references in C++11
is_common_type
C++11:
__half array_h[6]; auto value1 = cub::Min{}(array_h[0], array_h[1]); auto value2 = cub::Min{}(cub::Min{}(array_h[0], array_h[1]), array_h[2]); static_assert(cuda::std::is_same<decltype(value1), __half>::value, ""); // ok static_assert(cuda::std::is_same<decltype(value2), float>::value, ""); // ok, ??? static_assert(cuda::std::is_same<decltype(value2), __half>::value, ""); // fail
for refernce, cub::Min is defined as
cub::Min
struct Min { /// Boolean min operator, returns `(t < u) ? t : u` template <typename T, typename U> _CCCL_NODISCARD _CCCL_HOST_DEVICE _CCCL_FORCEINLINE _CCCL_CONSTEXPR_CXX14 typename ::cuda::std::common_type<T, U>::type operator()(T&& t, U&& u) const { return CUB_MIN(t, u); } }; #define CUB_MIN(a, b) (((b) < (a)) ? (b) : (a))
static_assert(cuda::std::is_same<decltype(value2), __half>::value, ""); // ok
No response
I cannot reproduce the issue you are seeing: https://godbolt.org/z/6P9KKe896
it can be only be reproduced with latest version of CCCL
Is this a duplicate?
Type of Bug
Compile-time Error
Component
libcu++
Describe the bug
is_common_type
does not work as expected when mixing rvalue references in C++11How to Reproduce
C++11:
for refernce,
cub::Min
is defined asExpected behavior
Reproduction link
No response
Operating System
No response
nvidia-smi output
No response
NVCC version
No response