Skip to content

Commit 09f727e

Browse files
committed
Add test for issue #20469
1 parent f4bb1ba commit 09f727e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/boundscheck_exec.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,14 @@ else
229229
@test inbounds_isassigned(Int[], 2) == false
230230
end
231231

232+
# Test that @inbounds annotations don't propagate too far for Array; Issue #20469
233+
struct BadVector20469{T} <: AbstractVector{Int}
234+
data::T
235+
end
236+
Base.size(X::BadVector20469) = size(X.data)
237+
Base.getindex(X::BadVector20469, i::Int) = X.data[i-1]
238+
if bc_opt != bc_off
239+
@test_throws BoundsError BadVector20469([1,2,3])[:]
240+
end
241+
232242
end

0 commit comments

Comments
 (0)