summaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCUDA/lambda-constexpr-capture.cu
AgeCommit message (Collapse)Author
2025-04-23[CUDA][HIP] capture possible ODR-used var (#136645)Yaxun (Sam) Liu
In a lambda function, a call of a function may resolve to host and device functions with different signatures. Especially, a constexpr local variable may be passed by value by the device function and passed by reference by the host function, which will cause the constexpr variable captured by the lambda function in host compilation but not in the device compilation. The discrepancy in the lambda captures will violate ODR and causes UB for kernels using these lambdas. This PR fixes the issue by identifying discrepancy of ODR/non-ODR usages of constexpr local variables passed to host/device functions and conservatively capture them. Fixes: https://github.com/llvm/llvm-project/issues/132068