The following snippet results into nvcc error : 'cicc' died due to signal 11 (Invalid memory reference)
// file.cu
#include <vector>
#include <type_traits>
template< class C, class E >
struct is_compatible_container : std::bool_constant <true>{};
template< class T >
struct span
{
span() {}
// Remove this constructor and cicc does not core dump any more.
// The `&&` operator within the template causes the core dump in combination with
// the inheritance from std::bool_constant
template< class Container
, typename std::enable_if<
is_compatible_container< Container, T >::value
&& std::bool_constant<true>::value, int >::type = 0
>
span( Container const & cont ) {}
};
int main() {
std::vector<span<float>> vs;
span<float> s;
vs.push_back(s);
}
Compile with nvcc -std=c++17 file.cu -o out
.
I used CUDA 11.0.194 with GCC 9.2.0 as host compiler on a Linux based system. The compiliation works fine on Windows or on Windows Linux Subsystem. The Bug occured initially in combination with the use of the gsl-lite
, which can be seen here.