Thrust fail to compile

Hi,

My code failed to compile with CUDA 11.2 due to a clash with some system-wise defined macro.

The problem is located at file logical_metafunctions.h (thrust/type_traits). One can find there a variadic template code using a type B0. Unfortunately, B0 is defined as 000000 in a system header, thus creating an illegal code.

I replaced B0 to _B0 and the problem disappeared.

The compiler error was:

/usr/local/cuda/include/thrust/type_traits/logical_metafunctions.h(135): error: expected a “,” or “>”

/usr/local/cuda/include/thrust/type_traits/logical_metafunctions.h(157): error: expected a “,” or “>”

The code snippet after correction:

<<< line 134 @ logical_metafunctions.h
template <bool _B0, bool… BN>
struct conjunction_value<_B0, BN…>
: std::integral_constant<bool, _B0 && conjunction_value<BN…>::value> {};

///////////////////////////////////////////////////////////////////////////////

/// An \c integral_constant whose value is (… || Bs).
template <bool… Bs>
struct disjunction_value;

#if THRUST_CPP_DIALECT >= 2014
/// A constexpr bool whose value is (… || Bs).
template <bool… Bs>
constexpr bool disjunction_value_v = disjunction_value<Bs…>::value;
#endif

template <>
struct disjunction_value<> : std::false_type {};

template
struct disjunction_value : std::integral_constant<bool, B> {};

template <bool _B0, bool… BN>
struct disjunction_value<_B0, BN…>
: std::integral_constant<bool, _B0 || disjunction_value<BN…>::value> {};

===============================================================

I’m using Fedora 33 with gcc:
gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

My CUDA version is:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Feb_14_21:12:58_PST_2021
Cuda compilation tools, release 11.2, V11.2.152
Build cuda_11.2.r11.2/compiler.29618528_0

I did not try it with the newer CUDA version…

Regards,

Ron.