diff --git a/base/subarray.jl b/base/subarray.jl index c15a4d48868fa..2b8545c2cc226 100644 --- a/base/subarray.jl +++ b/base/subarray.jl @@ -412,19 +412,19 @@ end function _unsetindex!(V::FastSubArray, i::Int) @inline - @boundscheck checkbounds(Bool, V, i) + @boundscheck checkbounds(V, i) @inbounds _unsetindex!(V.parent, _reindexlinear(V, i)) return V end function _unsetindex!(V::FastSubArray{<:Any,1}, i::Int) @inline - @boundscheck checkbounds(Bool, V, i) + @boundscheck checkbounds(V, i) @inbounds _unsetindex!(V.parent, _reindexlinear(V, i)) return V end function _unsetindex!(V::SubArray{T,N}, i::Vararg{Int,N}) where {T,N} @inline - @boundscheck checkbounds(Bool, V, i...) + @boundscheck checkbounds(V, i...) @inbounds _unsetindex!(V.parent, reindex(V.indices, i)...) return V end diff --git a/test/subarray.jl b/test/subarray.jl index ada53d7d91ee3..31bd69cccb5ae 100644 --- a/test/subarray.jl +++ b/test/subarray.jl @@ -1062,6 +1062,8 @@ end for i in eachindex(A) @test !isassigned(A, i) end + inds = eachindex(A) + @test_throws BoundsError Base._unsetindex!(A, last(inds) + oneunit(eltype(inds))) end @testset "dest IndexLinear, src IndexLinear" begin for p in (fill(BigInt(2)), BigInt[1, 2], BigInt[1 2; 3 4])