hliao added a comment. In D71227#1778136 <https://reviews.llvm.org/D71227#1778136>, @tra wrote:
> I wonder if this patch will help with this case: > > https://godbolt.org/z/X4KdsV > > __device__ float fn(int) { return threadIdx.x; }; > __host__ float fn(float); > > float gvar1 = []()__device__ { return fn(1);} (); // This ends up calling > fn(int) on *host* > > > > We seem to happily let host code call __device__ function from a lambda > function used as an initializer. It's turned out that `Sema::CheckCUDACall` needs to consider global initializer as well. I will revise that part. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71227/new/ https://reviews.llvm.org/D71227 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits