diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index bafb9da6d..11fe09b52 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -13,7 +13,10 @@ \item Count variables were switches to \code{size_t} to avoid warnings about conversion-narrowing (Dirk in \ghpr{1307}) \item Rcpp now avoids the usage of the (non-API) DATAPTR function when - accessing the contents of Rcpp Vector objects where possible. + accessing the contents of Rcpp Vector objects where possible. (Kevin in + \ghpr{1310}) + \item Rcpp now throws an R error on out-of-bounds Vector accesses. (Kevin + in \ghpr{1310}) } \item Changes in Rcpp Deployment: \itemize{ diff --git a/inst/include/Rcpp/vector/traits.h b/inst/include/Rcpp/vector/traits.h index de8cb9fbb..ff27ef86a 100644 --- a/inst/include/Rcpp/vector/traits.h +++ b/inst/include/Rcpp/vector/traits.h @@ -93,8 +93,8 @@ namespace traits{ void check_index(R_xlen_t i) const { #ifndef RCPP_NO_BOUNDS_CHECK - if (i >= size) { - stop("subscript out of bounds (index %s >= vector size %s)", i, size); + if (i >= p->size()) { + stop("subscript out of bounds (index %s >= vector size %s)", i, p->size()); } #endif }