NVC++ 20.9 fails to compile code instantiating any std::tuple with GCC 10.2 on C++ 17

The title pretty much explains it all. The code:

    #include <tuple>

    int main()
    {
        std::tuple<int> t{1};
    }

(Note: the compilation only fails if a value is supplied in the constructor.)
The compilation command is nvc++ test.cpp --c++17

The error is:

"/usr/include/c++/10.2.0/tuple", line 566: error: pack "_UElements" does not
          have the same number of elements as "_Elements"
  	    __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
  	                                               ^
          detected during instantiation of "bool
                    std::tuple<_Elements...>::__nothrow_constructible<_UElement
                    s...>() [with _Elements=<int>, _UElements=<>]" at line 5 of
                    "test.cpp"
nvc++ -v:
    Export PGI_CURR_CUDA_HOME=/opt/nvidia/hpc_sdk/Linux_x86_64/20.9/cuda/
    Export NVCOMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/20.9
    Export PGI=/opt/nvidia/hpc_sdk
    nvc++-Warning-No files to process

The OS is x86_64 Arch Linux on the LTS kernel.

Looks to have been a known issue that’s since been fixed in the 20.11 release:

% nvc++ tuple.cpp --c++17 -c  -V20.11
"tuple.cpp", line 5: warning: variable "t" was declared but never referenced
          std::tuple<int> t{1};
                          ^

% nvc++ tuple.cpp --c++17 -c -V20.9
"/home/sw/thirdparty/gcc/gcc-10.2.0/Linux_x86_64/include/c++/10.2.0/tuple",
          line 566: error: pack "_UElements" does not have the same number of
          elements as "_Elements"
            __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
                                                       ^
          detected during instantiation of "bool
                    std::tuple<_Elements...>::__nothrow_constructible<_UElement
                    s...>() [with _Elements=<int>, _UElements=<>]" at line 5 of
                    "tuple.cpp"

"tuple.cpp", line 5: warning: variable "t" was declared but never referenced
          std::tuple<int> t{1};
                          ^

1 error detected in the compilation of "tuple.cpp".

Thanks for the response. Is version 20.11 available for download yet? The latest version on the download page is listed as 20.9

Not quite, but very soon.

Thanks for your help :)!

Just encountered this issue using the Cuda Toolkit 11.1 on ubuntu 20.04 with GCC-10.

Can confirm upgrading to the Cuda Toolkit 11.2.1 will fix it.

Hi fotofill.holland,

Sorry but I’m clear on your post. The original error was with nvc++ and the GNU 10.2 STL for the host. No CUDA was used. Did you see a similar error with nvcc and that this was fixed in CUDA 11.2?

-Mat