diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index de5648fe8527..f59a438d3eb4 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -121,14 +121,12 @@ public: const_reverse_iterator rend() const { return const_reverse_iterator(begin());} - /* These asserts could be "Begin + idx < End", but there are lots of places - in llvm where we use &v[v.size()] instead of v.end(). */ reference operator[](unsigned idx) { - assert (Begin + idx <= End); + assert (Begin + idx < End); return Begin[idx]; } const_reference operator[](unsigned idx) const { - assert (Begin + idx <= End); + assert (Begin + idx < End); return Begin[idx]; }