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

<memory>: Re-fancy the raw pointer in _Ref_count_unbounded_array_alloc::_Delete_this for deallocation #4074

Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions stl/inc/memory
Original file line number Diff line number Diff line change
Expand Up @@ -2693,15 +2693,16 @@ private:
void _Delete_this() noexcept override { // destroy self
constexpr size_t _Align = alignof(_Ref_count_unbounded_array_alloc);
using _Storage = _Alignas_storage_unit<_Align>;
using _Rebound_alloc = _Rebind_alloc_t<_Alloc, _Storage>;

_Rebind_alloc_t<_Alloc, _Storage> _Al(this->_Get_val());
_Rebound_alloc _Al(this->_Get_val());
const size_t _Bytes =
_Calculate_bytes_for_flexible_array<_Ref_count_unbounded_array_alloc, _Check_overflow::_Nope>(_Size);
const size_t _Storage_units = _Bytes / sizeof(_Storage);

this->~_Ref_count_unbounded_array_alloc();

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

Expand Down
1 change: 0 additions & 1 deletion tests/libcxx/expected_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,6 @@ std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invok
std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp:1 FAIL
std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp:0 FAIL
std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp:1 FAIL
std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.array.unbounded.pass.cpp FAIL
std/utilities/meta/meta.logical/conjunction.compile.pass.cpp FAIL
std/utilities/meta/meta.logical/disjunction.compile.pass.cpp FAIL
std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp:0 FAIL
Expand Down