From: Casey Bodley Date: Mon, 14 Feb 2022 22:56:33 +0000 (-0500) Subject: neorados: assoc_delete() uses allocator_traits X-Git-Tag: v18.0.0~1237^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=916cd753e090372af60cf33b3d2408c0e591c7bf;p=ceph.git neorados: assoc_delete() uses allocator_traits the std::allocator member functions destroy() and deallocate() were deprecated in c++17 and removed in c++20. call the static functions on std::allocator_traits instead resolves the c++20 compilation error with clang13: In file included from ceph/src/test/cls_fifo/bench_cls_fifo.cc:38: ceph/src/neorados/cls/fifo.h:684:7: error: no member named 'destroy' in 'std::allocator, std::allocator>>>' a.destroy(t); ~ ^ ceph/src/neorados/cls/fifo.h:1728:11: note: in instantiation of function template specialization 'neorados::cls::fifo::FIFO::assoc_delete, std::allocator>, neorados::cls::fifo::detail::JournalProcessor, std::allocator>>>' requested here FIFO::assoc_delete(h, this); ^ ceph/src/neorados/cls/fifo.h:1605:6: note: in instantiation of member function 'neorados::cls::fifo::detail::JournalProcessor, std::allocator>>::handle' requested here handle(errc::inconsistency); ^ ceph/src/neorados/cls/fifo.h:857:8: note: in instantiation of member function 'neorados::cls::fifo::detail::JournalProcessor, std::allocator>>::process' requested here p->process(); ^ /usr/include/boost/asio/bind_executor.hpp:407:12: note: in instantiation of member function 'neorados::cls::fifo::FIFO::NewPartPreparer, std::allocator>>::operator()' requested here return this->target_(BOOST_ASIO_MOVE_CAST(Args)(args)...); ^ ceph/src/common/async/bind_allocator.h:179:12: note: in instantiation of function template specialization 'boost::asio::executor_binder, std::allocator>>, boost::asio::executor>::operator()' requested here return this->target(std::forward(args)...); ^ ceph/src/neorados/cls/fifo.h:939:5: note: in instantiation of function template specialization 'neorados::cls::fifo::FIFO::_update_meta, std::allocator>>, boost::asio::executor>, std::allocator>>' requested here _update_meta(fifo::update{}.journal_entries_add(jentries), ^ ceph/src/neorados/cls/fifo.h:1008:7: note: in instantiation of function template specialization 'neorados::cls::fifo::FIFO::_prepare_new_part, std::allocator>>' requested here _prepare_new_part( ^ ceph/src/neorados/cls/fifo.h:524:7: note: in instantiation of function template specialization 'neorados::cls::fifo::FIFO::_prepare_new_head, void>>, boost::asio::executor>, std::allocator>>' requested here _prepare_new_head(std::move(p)); ^ Signed-off-by: Casey Bodley --- diff --git a/src/neorados/cls/fifo.h b/src/neorados/cls/fifo.h index 4c7ba4779ec..b95f7f94ffe 100644 --- a/src/neorados/cls/fifo.h +++ b/src/neorados/cls/fifo.h @@ -667,11 +667,13 @@ private: template static void assoc_delete(const Handler& handler, T* t) { - typename std::allocator_traits::type> - ::template rebind_alloc a( - ba::get_associated_allocator(handler)); - a.destroy(t); - a.deallocate(t, 1); + using Alloc = ba::associated_allocator_t; + using Traits = typename std::allocator_traits; + using RebindAlloc = typename Traits::template rebind_alloc; + using RebindTraits = typename std::allocator_traits; + RebindAlloc a(get_associated_allocator(handler)); + RebindTraits::destroy(a, t); + RebindTraits::deallocate(a, t, 1); } FIFO(RADOS& r,