From bdd78ac9a21eb3118cc7147d617815ebb3cbce73 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 5 Aug 2024 14:01:08 -0400 Subject: [PATCH] rgw/notify: visit() returns copy of owner string MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit return a copy of the owner string to work around compiler warning: ceph/src/rgw/driver/rados/rgw_notify.cc: In function ‘int rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)’: ceph/src/rgw/driver/rados/rgw_notify.cc:1113:26: warning: possibly dangling reference to a temporary [-Wdangling-reference] 1113 | const std::string& topic_tenant = std::visit(fu2::overload( | ^~~~~~~~~~~~ ceph/src/rgw/driver/rados/rgw_notify.cc:1113:51: note: the temporary was destroyed at the end of the full expression ‘std::visit, rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*):: >, variant&>(fu2::overload, rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*):: >(rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)::(), rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)::()), topic_cfg.rgw_pubsub_topic::owner)’ 1113 | const std::string& topic_tenant = std::visit(fu2::overload( | ~~~~~~~~~~^~~~~~~~~~~~~~~ 1114 | [] (const rgw_user& u) -> const std::string& { return u.tenant; }, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1115 | [] (const rgw_account_id& a) -> const std::string& { return a; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1116 | ), topic_cfg.owner); | ~~~~~~~~~~~~~~~~~~~ Fixes: https://tracker.ceph.com/issues/67326 Signed-off-by: Casey Bodley (cherry picked from commit fe4f03dfcc5139aaa89a0a9c164eeb56b9fa4a6e) --- src/rgw/driver/rados/rgw_notify.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index 87c0247cf0a..b47dd88e18b 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -1087,8 +1087,8 @@ int publish_reserve(const DoutPrefixProvider* dpp, // reload the topic in case it changed since the notification was added const std::string& topic_tenant = std::visit(fu2::overload( - [] (const rgw_user& u) -> const std::string& { return u.tenant; }, - [] (const rgw_account_id& a) -> const std::string& { return a; } + [] (const rgw_user& u) -> std::string { return u.tenant; }, + [] (const rgw_account_id& a) -> std::string { return a; } ), topic_cfg.owner); const RGWPubSub ps(res.store, topic_tenant, site); int ret = ps.get_topic(res.dpp, topic_cfg.dest.arn_topic, -- 2.39.5