Skip to content

Commit a29682a

Browse files
authored
Refuse opaque closures. (#447)
1 parent 5de5a5c commit a29682a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/validation.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ function check_invocation(@nospecialize(job::CompilerJob))
8888
Core.Compiler.isconstType(dt) && continue
8989
real_arg_i += 1
9090

91+
@static if VERSION >= v"1.7"
92+
# XXX: can we support these for CPU targets?
93+
if dt <: Core.OpaqueClosure
94+
throw(KernelError(job, "passing an opaque closure",
95+
"""Argument $arg_i to your kernel function is an opaque closure.
96+
This is a CPU-only object not supported by GPUCompiler."""))
97+
end
98+
end
99+
91100
if !isbitstype(dt)
92101
throw(KernelError(job, "passing and using non-bitstype argument",
93102
"""Argument $arg_i to your kernel function is of type $dt, which is not isbits:

0 commit comments

Comments
 (0)