From c0586121078b9f5dd0d6c0f16a764d7e7e409b59 Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Wed, 30 Aug 2017 18:34:57 -0400 Subject: [PATCH] Add test for issue #20469 --- test/boundscheck_exec.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/boundscheck_exec.jl b/test/boundscheck_exec.jl index d94cd5e95e915c..35e61536ddb2d1 100644 --- a/test/boundscheck_exec.jl +++ b/test/boundscheck_exec.jl @@ -229,4 +229,14 @@ else @test inbounds_isassigned(Int[], 2) == false end +# Test that @inbounds annotations don't propagate too far for Array; Issue #20469 +struct BadVector20469{T} <: AbstractVector{Int} + data::T +end +Base.size(X::BadVector20469) = size(X.data) +Base.getindex(X::BadVector20469, i::Int) = X.data[i-1] +if bc_opt != bc_off + @test_throws BoundsError BadVector20469([1,2,3])[:] +end + end