<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/121825>121825</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [CUDA] Clang 19 is unable to compile CUDA on Windows
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          SEt-t
      </td>
    </tr>
</table>

<pre>
    Compiling trivial CUDA code
```cpp
#include <cuda.h>

int main()
{
    int device_count;
    cudaGetDeviceCount(&device_count);

    return device_count;
}
```
on Windows with
`clang++ kernel.cu --cuda-gpu-arch=sm_61 -Wno-unknown-cuda-version -lcudart_static --cuda-path="%CUDA_PATH%" -L"%CUDA_PATH%\lib\x64"`
works fine with Clang 18, but Clang 19 produces compilation errors:
```
In file included from <built-in>:1:
In file included from C:\Program Files\LLVM\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from C:\Program Files\LLVM\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio 2022\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio 2022\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio 2022\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_wstdio.h:486:24: error: non-const lvalue reference to type '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  486 | __crt_va_start(_ArgList, _Locale);
      | ^~~~~~~~
C:\Program Files\LLVM\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      | ^~
In file included from <built-in>:1:
In file included from C:\Program Files\LLVM\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from C:\Program Files\LLVM\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio 2022\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio 2022\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio 2022\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_wstdio.h:488:22: error: non-const lvalue reference to type '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  488 | __crt_va_end(_ArgList);
      |                      ^~~~~~~~
C:\Program Files\LLVM\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap) __builtin_va_end(ap)
      | ^~
...
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsV0tv2zgQ_jX0ZSBBGol6HHxQ5Hq32BQokG56FGiKtrmhSIGi7PSyv31ByXk4cYHdoF30ECFATA5n5psHP3DYMMidFmJJ6BWhqwUb3d7Y5c0HF7jFxrTflrXpeqmk3oGz8iCZgvrPVQXctIJEFcmi-Y_3vV9iIjVXYyuAJDUfWxbuSfLBS6JKagcdk5pgQbD0e_kViSoAAC9qxUFy0XAzakeSB4m38Ztwq0lYTzKvnp2dxnJWOOlY4UarLxgk-eo5ZhJVRsNXqVtzHOAo3X6WcsX0juAVwSu4E1YLFfIRgsBjCXb9GDDL9yRZDV2TxRB81SYY9Z02Rz0fOQg7SKMhUH5pXTM45iR_sNAz57UJIkHqk9l8rr78TpASRAiuL-zTWskNofV9lnrphPxo7N0AW6nFhBxqDxrigmANm9E9rEvorWlHLgbgUyWZ89CEtcYOJK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