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

Cannot reshape zero-dimensional arrays #26163

Closed
mbauman opened this issue Feb 22, 2018 · 0 comments
Closed

Cannot reshape zero-dimensional arrays #26163

mbauman opened this issue Feb 22, 2018 · 0 comments
Labels
arrays [a, r, r, a, y, s] bug Indicates an unexpected problem or unintended behavior

Comments

@mbauman
Copy link
Sponsor Member

mbauman commented Feb 22, 2018

julia> struct Z <: AbstractArray{Int,0}; end
       Base.size(::Z) = ()
       Base.getindex(::Z) = 0

julia> Z()
0-dimensional Z:
0

julia> reshape(Z(), 1)
ERROR: ArgumentError: Cannot call front on an empty tuple
Stacktrace:
 [1] _front at ./tuple.jl:101 [inlined]
 [2] front at ./tuple.jl:99 [inlined]
 [3] __reshape at ./reshapedarray.jl:165 [inlined]
 [4] _reshape at ./reshapedarray.jl:152 [inlined]
 [5] reshape at ./reshapedarray.jl:92 [inlined]
 [6] reshape(::Z, ::Int64) at ./reshapedarray.jl:95
 [7] top-level scope
@mbauman mbauman added arrays [a, r, r, a, y, s] bug Indicates an unexpected problem or unintended behavior labels Feb 22, 2018
mbauman added a commit that referenced this issue Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant