[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
Mon Feb 4 20:17:09 PST 2019
Quuxplusone updated this revision to Diff 185225.
Quuxplusone added a comment.
Rebased on master. @EricWF ping! It's been quite a few months...
Repository:
rCXX libc++
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D47344/new/
https://reviews.llvm.org/D47344
Files:
src/experimental/memory_resource.cpp
Index: src/experimental/memory_resource.cpp
===================================================================
--- src/experimental/memory_resource.cpp
+++ src/experimental/memory_resource.cpp
@@ -25,19 +25,20 @@
class _LIBCPP_TYPE_VIS __new_delete_memory_resource_imp
: public memory_resource
{
-public:
- ~__new_delete_memory_resource_imp() = default;
-
-protected:
- virtual void* do_allocate(size_t __size, size_t __align)
- { return _VSTD::__libcpp_allocate(__size, __align); /* FIXME */}
+ void *do_allocate(size_t size, size_t align) override {
+#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+ if (__is_overaligned_for_new(align))
+ __throw_bad_alloc();
+#endif
+ return _VSTD::__libcpp_allocate(size, align);
+ }
- virtual void do_deallocate(void* __p, size_t __n, size_t __align) {
- _VSTD::__libcpp_deallocate(__p, __n, __align); /* FIXME */
+ void do_deallocate(void *p, size_t n, size_t align) override {
+ _VSTD::__libcpp_deallocate(p, n, align);
}
- virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT
- { return &__other == this; }
+ bool do_is_equal(memory_resource const & other) const _NOEXCEPT override
+ { return &other == this; }
};
// null_memory_resource()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47344.185225.patch
Type: text/x-patch
Size: 1298 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190205/c9167845/attachment.bin>
More information about the cfe-commits
mailing list