summaryrefslogtreecommitdiffstats
path: root/libcxx/include/vector
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/vector')
-rw-r--r--libcxx/include/vector3
1 files changed, 2 insertions, 1 deletions
diff --git a/libcxx/include/vector b/libcxx/include/vector
index d1bc23e6a81..e04c2673b2e 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -1615,7 +1615,8 @@ vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
_LIBCPP_ASSERT(__first <= __last, "vector::erase(first, last) called with invalid range");
pointer __p = this->__begin_ + (__first - begin());
iterator __r = __make_iter(__p);
- this->__destruct_at_end(_VSTD::move(__p + (__last - __first), this->__end_, __p));
+ if (__first != __last)
+ this->__destruct_at_end(_VSTD::move(__p + (__last - __first), this->__end_, __p));
return __r;
}
OpenPOWER on IntegriCloud