Skip to content
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

Segment fault cause by Base.convert returning wrong type #11874

Closed
dlfivefifty opened this issue Jun 26, 2015 · 0 comments
Closed

Segment fault cause by Base.convert returning wrong type #11874

dlfivefifty opened this issue Jun 26, 2015 · 0 comments
Labels
bug Indicates an unexpected problem or unintended behavior regression Regression in behavior compared to a previous version

Comments

@dlfivefifty
Copy link
Contributor

An overloaded convert routine that returns the wrong type causes a segment fault in 0.4 but in 0.3 correctly throws the error

ERROR: type: bar: in typeassert, expected Foo, got Float64
 in bar at none:5

Here is an example:

 immutable Foo
   x::Int
end

function bar(x)
   y::Foo
   y=x
end

Base.convert(::Type{Foo},x::Int) = float(x)

bar(1)
@simonster simonster added bug Indicates an unexpected problem or unintended behavior regression Regression in behavior compared to a previous version labels Jun 26, 2015
@Keno Keno closed this as completed in 9abe7fe Jun 28, 2015
JeffBezanson added a commit that referenced this issue Jun 28, 2015
KristofferC pushed a commit to KristofferC/julia that referenced this issue Jun 30, 2015
When in branches that type inference knows are dead, type information
can be inaccurate and codegen basically just needs to bail out as fast
as possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

2 participants