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

method dispatch bug on incomplete parameterized types / type constructor issue #7074

Closed
vtjnash opened this issue Jun 2, 2014 · 0 comments
Closed
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@vtjnash
Copy link
Member

vtjnash commented Jun 2, 2014

unlike DataTypes, the Array type template is incomplete, which leads to unexpected dispatch:

julia> z{T<:Base.BLAS.BlasFloat}(A::StridedMatrix{T}) = T

julia> let
                  dim=2
                  S=zeros(Complex,dim,dim)
                  @show typeof(S)
                  z(S)
              end
typeof(S) => Array{Complex{T<:Real},2}
Union(Complex{Float64},Complex{Float32})

(code from #4796)

note that we can obtain a similar failure from BitsTypes:

julia> bitstype 64 A{T} <: Real

julia> reinterpret(A{Int}, 1)
A{Int64}(0x0000000000000001)

julia> reinterpret(A{Real}, 1)
A{Real}(0x0000000000000001)

julia> reinterpret(A, 1)
Segmentation fault (core dumped)
@vtjnash vtjnash added the bug label Jun 2, 2014
@vtjnash vtjnash changed the title method dispatch bug / Array type constructor issue method dispatch bug on incomplete parameterized types / type constructor issue Jun 2, 2014
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
Projects
None yet
Development

No branches or pull requests

1 participant