Skip to content

Commit a7d61bc

Browse files
committed
Add internal assertions
1 parent d85cfc9 commit a7d61bc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libcxx/include/__vector/vector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ class _LIBCPP_TEMPLATE_VIS vector {
655655
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
656656
// `__bounded_iter` will tell the compiler that `__p` is bounded by `__begin_` and `__end_cap`, but nothing a priori
657657
// relates `__p` to `__end_`.
658+
_LIBCPP_ASSERT_INTERNAL(__p <= this->__end_, "vector::__make_iter passed an invalid pointer");
658659
_LIBCPP_ASSUME(__p <= this->__end_);
659660

660661
// Bound the iterator according to the capacity, rather than the size.
@@ -679,6 +680,7 @@ class _LIBCPP_TEMPLATE_VIS vector {
679680
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
680681
// `__bounded_iter` will tell the compiler that `__p` is bounded by `__begin_` and `__end_cap`, but nothing a priori
681682
// relates `__p` to `__end_`.
683+
_LIBCPP_ASSERT_INTERNAL(__p <= this->__end_, "vector::__make_iter passed an invalid pointer");
682684
_LIBCPP_ASSUME(__p <= this->__end_);
683685

684686
// Bound the iterator according to the capacity, rather than the size. See above.

0 commit comments

Comments
 (0)