Index: libcxx/trunk/include/__split_buffer =================================================================== --- libcxx/trunk/include/__split_buffer +++ libcxx/trunk/include/__split_buffer @@ -198,10 +198,12 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) { __alloc_rr& __a = this->__alloc(); + pointer __to_be_end = this->__end_; do { - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); - ++this->__end_; + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__to_be_end)); + ++__to_be_end; + this->__end_ = __to_be_end; --__n; } while (__n > 0); } @@ -217,10 +219,12 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { __alloc_rr& __a = this->__alloc(); + pointer __to_be_end = this->__end_; do { - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); - ++this->__end_; + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__to_be_end), __x); + ++__to_be_end; + this->__end_ = __to_be_end; --__n; } while (__n > 0); } Index: libcxx/trunk/include/vector =================================================================== --- libcxx/trunk/include/vector +++ libcxx/trunk/include/vector @@ -984,11 +984,13 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n) { allocator_type& __a = this->__alloc(); + pointer __to_be_end = this->__end_; do { __RAII_IncreaseAnnotator __annotator(*this); - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); - ++this->__end_; + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__to_be_end)); + ++__to_be_end; + this->__end_ = __to_be_end; --__n; __annotator.__done(); } while (__n > 0); @@ -1006,11 +1008,13 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { allocator_type& __a = this->__alloc(); + pointer __to_be_end = this->__end_; do { __RAII_IncreaseAnnotator __annotator(*this); - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); - ++this->__end_; + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__to_be_end), __x); + ++__to_be_end; + this->__end_ = __to_be_end; --__n; __annotator.__done(); } while (__n > 0);