This is cuda-10.1 with gcc-7.3.1 on RHEL 7.6. I’m compiling the 0_Simple/vectorAdd example.
$ nvcc --keep -v -ccbin g++ -I../../common/inc -m64 -gencode arch=compute_61,code=sm_61 -o vectorAdd.o -c vectorAdd.cu
.
.
.
#$ cudafe++ --c++14 --gnu_version=70301 --allow_managed --m64 --parse_templates --gen_c_file_name "vectorAdd.cudafe1.cpp" --stub_file_name "vectorAdd.cudafe1.stub.c" --module_id_file_name "vectorAdd.module_id" "vectorAdd.cpp4.ii"
#$ g++ -std=c++14 -D__CUDA_ARCH__=610 -c -x c++ -DCUDA_DOUBLE_MATH_FUNCTIONS -I"../../common/inc" "-I/home/joe/cuda-10.1/bin/../targets/x86_64-linux/include" -m64 -o "vectorAdd.o" "vectorAdd.cudafe1.cpp"
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:578:28: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:5033:20: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:5054:24: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:656:134: required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:6676:95: required from here
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’ without object
__p->_M_set_sharable();
A quick ckeck gives:
$ grep _M_set_sharable vectorAdd.cudafe1.cpp
void _M_set_sharable() noexcept
_M_set_sharable();
(_M_rep()->_M_set_sharable()); }
(__s._M_rep()->_M_set_sharable()); }
_M_set_sharable();
If I repeat the same with ‘-ccbin clang++’ or go back to cuda 10.0, everything compiles fine and the quick check gives in both cases:
$ grep _M_set_sharable vectorAdd.cudafe1.cpp
void _M_set_sharable() noexcept
this->_M_set_sharable();
(_M_rep()->_M_set_sharable()); }
((__s._M_rep())->_M_set_sharable()); }
__p->_M_set_sharable();
In Summary: Cuda 10.1 now produces wrong C++ for gcc (but not clang).