From a261fc632e476df62214dac88e6230562b075778 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 8 Aug 2020 00:26:21 +0800 Subject: [PATCH] rgw: hold reloader using unique_ptr instead of using optional<> for holding reloader, use unique_ptr<>. as `RGWRealmReloader` is neither trivially_copy_{assignable,constructible} nor is_trivially_move_{assignable, constructible}, because of the `Cond` member variable. but Clang++ and libc++ still tries to rely on a delgating copy constructor for constructing the optional instance even the optional object is created `in_place`. in this change, to workaround this issue, reloader is instead constructed using make_unique<> Signed-off-by: Kefu Chai (cherry picked from commit 2494ddbef5ad20cdfccf59911fccadb6f9848da0) --- src/rgw/rgw_main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 44609741ed74..c0c43a6ebf7b 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -565,8 +565,8 @@ int main(int argc, const char **argv) // add a watcher to respond to realm configuration changes RGWPeriodPusher pusher(store); RGWFrontendPauser pauser(fes, implicit_tenant_context, &pusher); - std::optional reloader(std::in_place, store, - service_map_meta, &pauser); + auto reloader = std::make_unique(store, + service_map_meta, &pauser); RGWRealmWatcher realm_watcher(g_ceph_context, store->svc.zone->get_realm()); realm_watcher.add_watcher(RGWRealmNotify::Reload, *reloader); -- 2.47.3