diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-09-03 15:25:29 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-09-03 15:25:29 +0100 |
commit | 7efe0dd0b43db1ac5070908290a3febfcfb73513 (patch) | |
tree | dca921548bea37d7126c0e8e74fee577384f544d /libstdc++-v3 | |
parent | 83a840a91fb3281f8980eaacdb7b5377778da3bb (diff) | |
download | gcc-7efe0dd0b43db1ac5070908290a3febfcfb73513.zip gcc-7efe0dd0b43db1ac5070908290a3febfcfb73513.tar.gz gcc-7efe0dd0b43db1ac5070908290a3febfcfb73513.tar.bz2 |
Fix vector::_Temporary_value::_M_ptr
The pointer argument to allocator_traits::construct and
allocator_traits::destroy should be a raw pointer, not the allocator's
pointer type. _Temporary_value::_M_ptr was returning the wrong type.
* include/bits/stl_vector.h (vector::_Temporary_value::_M_ptr):
Return raw pointer not allocator's pointer type.
(vector::_Temporary_value::_M_val): Use _M_ptr.
From-SVN: r264061
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_vector.h | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6a576ba..9fddb1e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,9 @@ 2018-09-03 Jonathan Wakely <jwakely@redhat.com> + * include/bits/stl_vector.h (vector::_Temporary_value::_M_ptr): + Return raw pointer not allocator's pointer type. + (vector::_Temporary_value::_M_val): Use _M_ptr. + PR libstdc++/87194 * include/bits/stl_map.h (map::map(initializer_list<value_type>, const Compare&, const Alloc&)) diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 6bb75b7..4785647 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -1667,11 +1667,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); } value_type& - _M_val() { return *reinterpret_cast<_Tp*>(&__buf); } + _M_val() { return *_M_ptr(); } private: - pointer - _M_ptr() { return pointer_traits<pointer>::pointer_to(_M_val()); } + _Tp* + _M_ptr() { return reinterpret_cast<_Tp*>(&__buf); } vector* _M_this; typename aligned_storage<sizeof(_Tp), alignof(_Tp)>::type __buf; |