[PATCH] D35863: Use the allocator's pointers for deallocation in `std::list`

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 15:56:26 PDT 2017


Quuxplusone created this revision.

`pointer_traits<P>::to_pointer(r)` is not required to return a deallocatable pointer; indeed generally it *cannot* determine a deallocatable representation without help from the allocator. Therefore, we must not rely on representations derived from `to_pointer` when deallocating; we must pass to `deallocate` the exact same pointer (or at least a pointer linearly derived from the pointer) that we originally received from `allocate`.

I have an example fancy-pointer allocator here which might be convertible into a test case:
https://github.com/Quuxplusone/from-scratch/blob/master/include/scratch/bits/containers/segmented-allocator.h


https://reviews.llvm.org/D35863

Files:
  include/list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35863.108173.patch
Type: text/x-patch
Size: 15253 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170725/a0806aea/attachment-0001.bin>


More information about the cfe-commits mailing list