[PATCH] D47344: LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 22:03:10 PDT 2018


Quuxplusone updated this revision to Diff 156210.
Quuxplusone edited the summary of this revision.
Quuxplusone added a comment.

Remove some incorrect `noexcept` from `<experimental/memory_resource>`.

I noticed this because the calls to `__clang_call_terminate` showed up on Godbolt. But the pessimization is still there even without these `noexcept`! Basically the flow is this:

  std::pmr::vector::~vector (noexcept(true))
  - polymorphic_allocator::destroy (noexcept(X) but inlineable)
    - ~T (noexcept(true))
  - polymorphic_allocator::deallocate (noexcept(X) but inlineable)
    - memory_resource::deallocate (noexcept(false) and not inlineable)

where "X" is "true" before this patch and "false" afterward.

Even for `monotonic_buffer_resource`, we can't conclude that deallocation will never throw, because deallocation *might* involve the upstream resource, which we don't know anything about.


Repository:
  rCXX libc++

https://reviews.llvm.org/D47344

Files:
  include/experimental/memory_resource
  src/experimental/memory_resource.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47344.156210.patch
Type: text/x-patch
Size: 3338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180719/79cab1b0/attachment.bin>


More information about the cfe-commits mailing list