-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert(::Type{Ptr{T1}}, x::Array{T2}) should fail if T1 != T2 #6073
Comments
+1 We have |
Yes I think this is reasonable along with a special case for |
Whoops, this breaks a bunch of the tests (sorry, I though I had run |
And if it breaks several places in |
Thanks for this change, it made me discover a bug in the NetCDF package, too. Is there a way to get a more meaningful (error?)-message than the deprecation warning? Or will the warning persist for julia 0.3 and an error be generated for julia 0.4? |
Right now, Julia will happily do:
This is an invitation for bugs; I just ran into this today with a student who was doing
ccall(:foo, Void, (Ptr{Cint},), x)
and didn't understand why it was failing forx = [1,2,3]
orx = [4.0, 5.0]
.My preference would be to throw an error in this case. We can still allow
convert(::Type{Ptr{T1}}, x::Ptr{T2})
to work, so if you want to do an explicit cast from one pointer type to another you can still do so.The text was updated successfully, but these errors were encountered: