template<typename _Alloc>
struct _Deleter
{
- void operator()(_Tp* __ptr)
+ void operator()(typename _Alloc::value_type* __ptr)
{
__allocated_ptr<_Alloc> __guard{ _M_alloc, __ptr };
allocator_traits<_Alloc>::destroy(_M_alloc, __guard.get());
rebind_traits<typename std::remove_cv<_Tp>::type> __traits;
_Deleter<typename __traits::allocator_type> __del = { __a };
auto __guard = std::__allocate_guarded(__del._M_alloc);
- _M_ptr = __guard.get();
+ auto __ptr = __guard.get();
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2070. allocate_shared should use allocator_traits<A>::construct
- __traits::construct(__del._M_alloc, _M_ptr,
+ __traits::construct(__del._M_alloc, __ptr,
std::forward<_Args>(__args)...);
__guard = nullptr;
- __shared_count<_Lp> __count(_M_ptr, __del, __del._M_alloc);
+ __shared_count<_Lp> __count(__ptr, __del, __del._M_alloc);
_M_refcount._M_swap(__count);
+ _M_ptr = __ptr;
__enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr);
}
#endif