Compilation error using nvcc with intel icpc as host compiler

Hello,

I have a very simple code (in src.cu)

int main()
{
    return 0;
}

which I am trying to compile with nvcc, with intel icpc compiler set as the cuda host compiler.

nvcc -ccbin=icpc src.cu -o program.x

It fails with an error

/apps/all/GCCcore/11.3.0/include/c++/11.3.0/bits/stl_pair.h(460): error: argument list for class template "std::pair" is missing

/apps/all/GCCcore/11.3.0/include/c++/11.3.0/bits/stl_pair.h(460): error: expected a ")"

/apps/all/GCCcore/11.3.0/include/c++/11.3.0/bits/stl_pair.h(460): error: template parameter "_T1" may not be redeclared in this scope

/apps/all/GCCcore/11.3.0/include/c++/11.3.0/bits/stl_pair.h(460): error: expected a ";"

4 errors detected in the compilation of "src.cu".

These are the lines in the stl_pair.h header file causing the error:

#if __cpp_deduction_guides >= 201606
  template<typename _T1, typename _T2> pair(_T1, _T2) -> pair<_T1, _T2>;
#endif

I am using intel/2022a module we have on our Karolina cluster (icpc --version 2021.6.0 20220226), CUDA 11.4.1 with

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Wed_Jul_14_19:41:19_PDT_2021
Cuda compilation tools, release 11.4, V11.4.100
Build cuda_11.4.r11.4/compiler.30188945_0

The system is running CentOS 7.

If I use intel/2021b (icpc 2021.4.0 20210910) or newer, it fails as described. But if I use intel/2021a (icpc 2021.2.0 20210228) or older, it then works with no problem.

How can I solve this issue?

Why are gcc headers included, if I am using icpc as a host compiler?

Why does it even produce an error?

Adding the -std=c++11 flag (or newer C++ standard) solves the issue, but I do not use any c++11 features anywhere in my code, so it should not be necessary. And according to nvcc docs and icpc docs, the C++ standard should be set to C++14 or higher by default. Running only icpc and testing the __cplusplus macro, it is C++17.

Related to enable_language(CUDA) fails with Intel icpc set as host compiler (#23763) · Issues · CMake / CMake · GitLab

I would appreciate any help with this.