[BUG]: Can't compile use of thrust::omp::par execution policy with CUDA 12.8 and MSVC 2022
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 486
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 295
Description
### Is this a duplicate?
- [x] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)
### Type of Bug
Compile-time Error
### Component
Thrust
### Describe the bug
Thrust fail to compile a project with CUDA 12.8 and MSVC 2022 (19.36.32545.0) when using directly `thrust::omp::par` execution policy
### How to Reproduce
I'm including directly the `thrust/system/omp/execution_policy.h` header, as I don't want to change the original `thrust::host` sequential behavior. This works well with GCC and linux, but with MSVC and windows I got this error:
```
my_sorting.cu
tmpxft_00003970_00000000-7_my_sorting.compute_80.cudafe1.cpp
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.8/include\thrust/system/omp/detail/sort.inl(163): error C2760: syntax error: '}' was unexpected here; expected 'statement'
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.8/include\thrust/system/omp/detail/sort.h(38): note: This diagnostic occurred in the compiler generated function 'void thrust::THRUST_200700_700_800_NS::system::omp::detail::stable_sort(thrust::THRUST_200700_700_800_NS::system::omp::detail::execution_policy &,RandomAccessIterator,RandomAccessIterator,StrictWeakOrdering)'
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.8/include\thrust/system/omp/detail/sort.inl(253): error C2760: syntax error: '}' was unexpected here; expected 'statement'
```
I'm using cmake to configure the project. The compilation line for this file is like this:
```
FAILED: PROJECT_PATH/my_sorting.cu.obj
C:\PROGRA~1\NVIDIA~2\CUDA\v12.8\bin\nvcc.exe -forward-unknown-to-host-compiler -ccbin=cl.exe -DBOOST_ALLOW_DEPRECATED_HEADERS -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB -DBOOST_BIND_GLOBAL_PLACEHOLDERS -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_TEST_INCLUDED -DCGAL_DISABLE_ROUNDING_MATH_CHECK -DCGAL_LICENSE_ERROR -DHAVE_SNPRINTF -DNOMINMAX -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_SCL_SECURE_NO_DEPRECATE -D_UNICODE -D_USE_MATH_DEFINES -IE:PROJECT_PATH -IE:\work\c++ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\include" -isystem=E:\Bin\miniforge3\envs\497746b\Library\include -isystem=E:\Bin\miniforge3\envs\497746b\Library\include\eigen3 -isystem=E:\Bin\miniforge3\envs\497746b\\Library\include -D_WINDOWS -Xcompiler=" /GR /EHsc" --extended-lambda --compiler-options="/openmp /bigobj" -Xcompiler="-O2 -Ob2" -DNDEBUG --generate-code=arch=compute_70,code=[compute_70,sm_70] --generate-code=arch=compute_80,code=[compute_80,sm_80] -Xcompiler=-MD -std=c++20 -MD -MT source\c++\project\CMakeFiles\my_lib.dir\my_sorting.cu.obj -MF PROJECT_PATH\my_sorting.cu.obj.d -x cu -rdc=true -c PROJECT_PATH\my_sorting.cu -o source\c++\project\CMakeFiles\my_lib.dir\my_sorting.cu.obj -Xcompiler=-FdPROJECT_PATH\my_lib.pdb,-FS
```
Adding a `;` after the last `THRUST_PRAGMA_OMP(barrier)` at lines 162 and 252 from file `thrust/system/omp/detail/sort.inl` seems to solve the issue
### Expected behavior
Compilation should work without errors
### Reproduction link
_No response_
### Operating System
Windows 11 Enterprise (OS Build 22621.5335)
### nvidia-smi output
_No response_
### NVCC version
```
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Wed_Jan_15_19:38:46_Pacific_Standard_Time_2025
Cuda compilation tools, release 12.8, V12.8.61
Build cuda_12.8.r12.8/compiler.35404655_0
```
Contributor guide
Assessment
This issue has not been assessed yet.