================ @@ -794,7 +794,7 @@ void CodeGenModule::Release() { AddGlobalCtor(ObjCInitFunction); if (Context.getLangOpts().CUDA && CUDARuntime) { if (llvm::Function *CudaCtorFunction = CUDARuntime->finalizeModule()) - AddGlobalCtor(CudaCtorFunction); + AddGlobalCtor(CudaCtorFunction, /*Priority=*/0); ---------------- argentite wrote:
The underlying issues is not actually clang-repl specific, it also affects clang. For example, this seems to succeed in `nvcc` but fails with `clang`: ```cpp #include <cstdio> __global__ void kernel() {} class C { public: C() { kernel<<<1, 1>>>(); printf("Error: %d\n", cudaGetLastError()); } }; C c; int main() {} ``` This is fixed by this patch. Maybe we can look for a proper solution to this? https://github.com/llvm/llvm-project/pull/66658 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits