We do not check that single-target @cfunction dispatches are fully-covered, which is required for to implement :call semantics properly:
julia> f(a::Cint,b::Cint) = a+b
julia> f(a::Float32, b::Cint) = a+b
julia> g(a::Float32, b::Cint) = a+b
julia> p = @cfunction(f, Any, (Any, Cint))
julia> q = @cfunction(g, Any, (Any, Cint))
julia> ccall(p, Any, (Any, Cint), Float32(1.52), 2)
3.52f0
julia> ccall(q, Any, (Any, Cint), Float32(1.52), 2)
3.52f0
julia> ccall(p, Any, (Any, Cint), 1.52, 2)
ERROR: MethodError: no method matching f(::Float64, ::Int32)
# ...
julia> ccall(q, Any, (Any, Cint), 1.52, 2)
2.0f0 # should be `MethodError` but instead UB
(and avoid UB)
found while trying to convince myself of the dispatch behavior in #62245
We do not check that single-target
@cfunctiondispatches are fully-covered, which is required for to implement:callsemantics properly:(and avoid UB)
found while trying to convince myself of the dispatch behavior in #62245