From abaa4f9ab6cf787cd5d18ac1630f2bcfc9d35aa1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 24 Nov 2020 14:28:58 +0800 Subject: [PATCH] neorados: use lambda instead of std::mem_fn() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit this addresses the FTBFS with GCC-10.2.0. FWIW, i cannot create a minimal reproducer. the error message was: /usr/bin/g++-10 -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D__CEPH__ -D__STDC_FORMAT_MACROS -D__linux__ -Isrc/include -I../src -isystem /opt/ceph/include -isystem include -isystem\ ../src/xxHash -isystem ../src/rapidjson/include -fno-omit-frame-pointer -g -fPIC -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifie\ rs -ftemplate-depth-1024 -Wpessimizing-move -Wredundant-move -Wstrict-null-sentinel -Woverloaded-virtual -fno-new-ttp-matching -DCEPH_DEBUG_MUTEX -fstack-protector-strong -D_GLIBCXX_ASSERTIONS -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-\ realloc -fno-builtin-free -std=c++17 -MD -MT src/neorados/CMakeFiles/neorados_api_obj.dir/RADOS.cc.o -MF src/neorados/CMakeFiles/neorados_api_obj.dir/RADOS.cc.o.d -o src/neorados/CMakeFiles/neorados_api_obj.dir/RADOS.cc.o -c ../src/neorados/RADOS.cc In file included from /usr/include/c++/10/bits/move.h:57, from /usr/include/c++/10/bits/stl_pair.h:59, from /usr/include/c++/10/utility:70, from /usr/include/c++/10/optional:36, from ../src/neorados/RADOS.cc:17: /usr/include/c++/10/type_traits: In substitution of ‘template static std::__result_of_success)().*(declval<_Fp>)()((declval<_Args>)()...)), std::__invoke_memfun_ref> std::__result_of_memfun_ref_impl::_S_tes\ t(int) [with _Fp = long int (OSDMap::*)(std::basic_string_view) const; _Tp1 = OSDMap&; _Args = {std::__cxx11::basic_string, std::allocator >&}]’: /usr/include/c++/10/type_traits:2377:56: required from ‘struct std::__result_of_memfun_ref) const, OSDMap&, std::__cxx11::basic_string, std::allocator >&>’ /usr/include/c++/10/type_traits:2463:21: required from ‘struct std::__result_of_memfun) const, OSDMap&, std::__cxx11::basic_string, std::allocator >&>’ /usr/include/c++/10/type_traits:2496:12: required from ‘struct std::__result_of_impl) const, OSDMap&, std::__cxx11::basic_string, std::allocator >&>’ /usr/include/c++/10/type_traits:2522:12: required from ‘struct std::__invoke_result) const, OSDMap&, std::__cxx11::basic_string, std::allocator >&>’ /usr/include/c++/10/bits/invoke.h:89:5: required by substitution of ‘template constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = long int (OSDMap::* const&)(std:\ :basic_string_view) const; _Args = {OSDMap&, std::__cxx11::basic_string, std::allocator >&}]’ /usr/include/c++/10/functional:121:27: required by substitution of ‘template decltype (std::__invoke(((const std::_Mem_fn_base) const, true>*)this)->std::_Mem_fn_base) const, true>::_M_pmf, (forward<_Args>)(std::_Mem_fn_base<_MemFunPtr, __is_mem_fn>::operator()::__args)...)) std::_Mem_fn_base) const, true>::operator()<_Args ...>(_Args&& ...) const [with _Args = {OSDMap&,\ std::__cxx11::basic_string, std::allocator >&}]’ ../src/osdc/Objecter.h:2600:38: required from ‘decltype(auto) Objecter::with_osdmap(Callback&&, Args&& ...) [with Callback = std::_Mem_fn) const>; Args = {std::__cxx11::basic_string, std::al\ locator >&}]’ ../src/neorados/RADOS.cc:903:9: required from here /usr/include/c++/10/type_traits:2366:50: internal compiler error: in build_over_call, at cp/call.c:8976 2366 | (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ 0x5de01a build_over_call ../../src/gcc/cp/call.c:8976 0xaa30fe build_new_method_call_1 ../../src/gcc/cp/call.c:10385 0xaa429e build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int) ../../src/gcc/cp/call.c:10460 0xaa429e build_special_member_call(tree_node*, tree_node*, vec**, tree_node*, int, int) ../../src/gcc/cp/call.c:9861 0xa94458 build_temp ../../src/gcc/cp/call.c:7128 0xa94458 convert_like_real_1 ../../src/gcc/cp/call.c:7705 0xa95b3d perform_implicit_conversion_flags(tree_node*, tree_node*, int, int) ../../src/gcc/cp/call.c:11921 0xca79f5 convert_arguments ../../src/gcc/cp/typeck.c:4197 0xca79f5 cp_build_function_call_vec(tree_node*, vec**, int, tree_node*) ../../src/gcc/cp/typeck.c:4031 0xb4c4d0 build_offset_ref_call_from_tree(tree_node*, vec**, int) ../../src/gcc/cp/decl2.c:5276 0xc28b46 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../src/gcc/cp/pt.c:20073 0xc2b204 tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:15946 0xc2db88 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:13193 0xc3331b tsubst_aggr_type ../../src/gcc/cp/pt.c:13396 0xc35911 tsubst_function_type ../../src/gcc/cp/pt.c:14942 0xc2ae00 tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:15753 0xc3988c tsubst_function_decl ../../src/gcc/cp/pt.c:13787 0xc2316f tsubst_decl ../../src/gcc/cp/pt.c:14230 0xc33a29 instantiate_template_1 ../../src/gcc/cp/pt.c:20871 0xc4321b instantiate_template(tree_node*, tree_node*, int) ../../src/gcc/cp/pt.c:20928 Please submit a full bug report, Signed-off-by: Kefu Chai --- src/neorados/RADOS.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/neorados/RADOS.cc b/src/neorados/RADOS.cc index 4c85d44d8341..a0baaab287d6 100644 --- a/src/neorados/RADOS.cc +++ b/src/neorados/RADOS.cc @@ -899,8 +899,9 @@ void RADOS::lookup_pool(std::string_view name, objecter = impl->objecter] (bs::error_code ec) mutable { int64_t ret = - objecter->with_osdmap(std::mem_fn(&OSDMap::lookup_pg_pool_name), - name); + objecter->with_osdmap([&](const OSDMap &osdmap) { + return osdmap.lookup_pg_pool_name(name); + }); if (ret < 0) ca::dispatch(std::move(c), osdc_errc::pool_dne, std::int64_t(0)); -- 2.47.3