summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/vector4
1 files changed, 4 insertions, 0 deletions
diff --git a/libcxx/include/vector b/libcxx/include/vector
index de7de093d58..8ac7576ae7f 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -2606,6 +2606,8 @@ vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x)
{
size_type __old_size = this->__size_;
this->__size_ += __n;
+ if (__old_size == 0 || (__old_size / __bits_per_word) != (this->__size_ / __bits_per_word))
+ this->__begin_[this->__size_ / __bits_per_word] = __storage_type(0);
_VSTD::fill_n(__make_iter(__old_size), __n, __x);
}
@@ -2620,6 +2622,8 @@ vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardI
{
size_type __old_size = this->__size_;
this->__size_ += _VSTD::distance(__first, __last);
+ if (__old_size == 0 || (__old_size / __bits_per_word) != (this->__size_ / __bits_per_word))
+ this->__begin_[this->__size_ / __bits_per_word] = __storage_type(0);
_VSTD::copy(__first, __last, __make_iter(__old_size));
}
OpenPOWER on IntegriCloud