Skip to content

nvcc cannot handle clang builtin #113125

Open
@ye-luo

Description

@ye-luo

After merging #111516, I started to see

$ nvcc -allow-unsupported-compiler -ccbin=clang++ main.cu
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/type_traits(2967): error: type name is not allowed
          bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)
                                                             ^

/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/type_traits(2967): error: type name is not allowed
          bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)
                                                                  ^

/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/type_traits(2967): error: identifier "__reference_converts_from_temporary" is undefined
          bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)
                         ^

3 errors detected in the compilation of "main.cu".

The error comes out of

#$ cudafe++ --c++17 --clang --clang_version=200000 --display_error_number --orig_src_file_name "main.cu" --orig_src_path_name "/home/yeluo/main.cu" --unicode_source_kind=UTF-8 --allow_managed  --m64 --parse_templates --gen_c_file_name "/tmp/tmpxft_000490f6_00000000-6_main.cudafe1.cpp" --stub_file_name "tmpxft_000490f6_00000000-6_main.cudafe1.stub.c" --gen_module_id_file --module_id_file_name "/tmp/tmpxft_000490f6_00000000-4_main.module_id" "/tmp/tmpxft_000490f6_00000000-5_main.cpp4.ii" 

main.cu

#include <type_traits>
int main() {}

My clang setting

$ clang++ -v
clang version 20.0.0git (https://github.com/llvm/llvm-project.git ed7868de03c7b93809f87ed1a01103b926564feb)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /soft/llvm/main-patched/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda-12.6, version 12.6
Found HIP installation: /opt/rocm-6.2.0, version 6.2.41133

failure requires gcc-13/14 toolchain.

I understand that nvcc needs to address this issue by supporting clang 19 and beyond but it takes time. I'm wondering if there is a way to workaround this issue and unblock me from using clang in development.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions