Skip to content

Regression: cfunction return type struct fields cannot contain a reference #25

@pablosanjose

Description

@pablosanjose

I get this error on v1.8 beta1 (not on 1.7.2), both under Intel and M1 macos, whenever I wrap a type containing a heap reference.

MWE:

julia> using FunctionWrappers: FunctionWrapper

julia> struct T
           x::Vector{Int}
       end

julia> FunctionWrapper{T,Tuple{}}(() -> T([1,2]))
ERROR: cfunction return type struct fields cannot contain a reference
Stacktrace:
 [1] macro expansion
   @ ~/.julia/packages/FunctionWrappers/8xdVB/src/FunctionWrappers.jl:83 [inlined]
 [2] gen_fptr
   @ ~/.julia/packages/FunctionWrappers/8xdVB/src/FunctionWrappers.jl:81 [inlined]
 [3] FunctionWrapper{T, Tuple{}}(obj::var"#1#2")
   @ FunctionWrappers ~/.julia/packages/FunctionWrappers/8xdVB/src/FunctionWrappers.jl:100
 [4] top-level scope
   @ REPL[3]:1
julia> versioninfo()
Julia Version 1.8.0-beta1
Commit 7b711ce699 (2022-02-23 15:09 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: 8 × Intel(R) Core(TM) i7-5775R CPU @ 3.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, broadwell)
  Threads: 1 on 8 virtual cores
Environment:
  JULIA_EDITOR = code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions