diff --git a/base/io.jl b/base/io.jl index fb883234be4df6..9f5bbf7416a9a8 100644 --- a/base/io.jl +++ b/base/io.jl @@ -804,7 +804,7 @@ unsafe_write(s::IO, p::Ptr, n::Integer) = unsafe_write(s, convert(Ptr{UInt8}, p) function write(s::IO, x::Ref{T}) where {T} x isa Ptr && error("write cannot copy from a Ptr") if isbitstype(T) - unsafe_write(s, x, Core.sizeof(T)) + Int(unsafe_write(s, x, Core.sizeof(T))) else write(s, x[]) end diff --git a/test/filesystem.jl b/test/filesystem.jl index 566ca08ec910e4..625bfc38e5e2f7 100644 --- a/test/filesystem.jl +++ b/test/filesystem.jl @@ -46,3 +46,7 @@ end @test_broken isempty(undoc) @test undoc == [:File, :Filesystem, :cptree, :futime, :rename, :sendfile, :unlink] end + +@testet "write return type" begin + @test Base.return_types(write, (Base.Filesystem.File, UInt8)) == [Int] +end