This was a contrived example to create the reference type. My issue involved an FFI function that indexed an element of an array stored inside a C++ object and returned a reference to it. From the docs I took "Reference types are dereferenced before a conversion can take place" to mean that it would convert to double automatically when used, but now I see that this doesn't apply here. I can modify the return type of the function to return by value for scalar types. Thanks for the clarification. Simon