Closed
Description
Given #19958 and #20079, there may be fixes already submitted for this (or possibly, this won't work in the future anyway), so for now I simply report this:
julia> a = reshape([5])
0-dimensional Array{Int64,0}:
5
julia> a[]
5
julia> a[1]
5
julia> immutable MyArray{T,N} <: AbstractArray{T,N}
parent::Array{T,N}
end
julia> b = MyArray(a);
julia> Base.getindex{T,N}(A::MyArray{T,N}, inds::Vararg{Int,N}) = A.parent[inds...]
julia> Base.size(A::MyArray) = size(A.parent)
julia> Base.linearindexing(A::MyArray) = Base.LinearFast()
julia> b[]
5
julia> b[1]
ERROR: indexing not defined for MyArray{Int64,0}
Stacktrace:
[1] getindex(::MyArray{Int64,0}, ::Int64) at ./abstractarray.jl:792
julia> versioninfo()
Julia Version 0.6.0-dev.2260
Commit b44faa3* (2017-01-22 03:01 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)
It succeeds if you omit the linearindexing
specialization.