Skip to content

Commit

Permalink
Fix truncation warnings in allocate_shared() (#4252)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanTLavavej authored Dec 14, 2023
1 parent 4e9a5cb commit 7276976
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions stl/inc/memory
Original file line number Diff line number Diff line change
Expand Up @@ -2670,7 +2670,8 @@ private:

this->~_Ref_count_unbounded_array_alloc();

_Al.deallocate(_STD _Refancy<_Alloc_ptr_t<_Rebound_alloc>>(reinterpret_cast<_Storage*>(this)), _Storage_units);
_Al.deallocate(_STD _Refancy<_Alloc_ptr_t<_Rebound_alloc>>(reinterpret_cast<_Storage*>(this)),
static_cast<_Alloc_size_t<_Rebound_alloc>>(_Storage_units));
}
};

Expand Down Expand Up @@ -2851,11 +2852,12 @@ struct _Allocate_n_ptr {
_Alloc_ptr_t<_Alloc> _Ptr;
size_t _Nx;

_Allocate_n_ptr(_Alloc& _Al_, const size_t _Nx_) : _Al(_Al_), _Ptr(_Al_.allocate(_Nx_)), _Nx(_Nx_) {}
_Allocate_n_ptr(_Alloc& _Al_, const size_t _Nx_)
: _Al(_Al_), _Ptr(_Al_.allocate(_Convert_size<_Alloc_size_t<_Alloc>>(_Nx_))), _Nx(_Nx_) {}

~_Allocate_n_ptr() {
if (_Ptr) {
_Al.deallocate(_Ptr, _Nx);
_Al.deallocate(_Ptr, static_cast<_Alloc_size_t<_Alloc>>(_Nx));
}
}

Expand Down

0 comments on commit 7276976

Please sign in to comment.