Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix truncation warnings in allocate_shared() #4252

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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