Skip to content

Commit fe4f03d

Browse files
committed
rgw/notify: visit() returns copy of owner string
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<fu2::abi_310::detail::overloading::overload_impl<rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)::<lambda(const rgw_user&)>, rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)::<lambda(const rgw_account_id&)> >, variant<rgw_user, rgw_account_id>&>(fu2::overload<rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)::<lambda(const rgw_user&)>, rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)::<lambda(const rgw_account_id&)> >(<lambda closure object>rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)::<lambda(const rgw_user&)>(), <lambda closure object>rgw::notify::publish_reserve(const DoutPrefixProvider*, const rgw::SiteConfig&, const EventTypeList&, reservation_t&, const RGWObjTags*)::<lambda(const rgw_account_id&)>()), 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 <[email protected]>
1 parent 01a9f08 commit fe4f03d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rgw/driver/rados/rgw_notify.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,8 @@ int publish_reserve(const DoutPrefixProvider* dpp,
11111111

11121112
// reload the topic in case it changed since the notification was added
11131113
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; }
1114+
[] (const rgw_user& u) -> std::string { return u.tenant; },
1115+
[] (const rgw_account_id& a) -> std::string { return a; }
11161116
), topic_cfg.owner);
11171117
const RGWPubSub ps(res.store, topic_tenant, site);
11181118
int ret = ps.get_topic(res.dpp, topic_cfg.dest.arn_topic,

0 commit comments

Comments
 (0)