Merge pull request #49874 from azat/build/fix

Fix "reference to local binding" after fixes for clang-17
This commit is contained in:
Alexander Tokmakov 2023-05-15 23:25:18 +03:00 committed by GitHub
commit c9d6ee3c98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -339,37 +339,37 @@ void KeeperStorage::UncommittedState::applyDelta(const Delta & delta)
nodes.emplace(delta.path, UncommittedNode{.node = nullptr}); nodes.emplace(delta.path, UncommittedNode{.node = nullptr});
} }
auto & [node, acls, last_applied_zxid] = nodes.at(delta.path);
std::visit( std::visit(
[&, &my_node = node, &my_acls = acls, &my_last_applied_zxid = last_applied_zxid]<typename DeltaType>(const DeltaType & operation) [&]<typename DeltaType>(const DeltaType & operation)
{ {
auto & [node, acls, last_applied_zxid] = nodes.at(delta.path);
if constexpr (std::same_as<DeltaType, CreateNodeDelta>) if constexpr (std::same_as<DeltaType, CreateNodeDelta>)
{ {
assert(!my_node); assert(!node);
my_node = std::make_shared<Node>(); node = std::make_shared<Node>();
my_node->stat = operation.stat; node->stat = operation.stat;
my_node->setData(operation.data); node->setData(operation.data);
my_acls = operation.acls; acls = operation.acls;
my_last_applied_zxid = delta.zxid; last_applied_zxid = delta.zxid;
} }
else if constexpr (std::same_as<DeltaType, RemoveNodeDelta>) else if constexpr (std::same_as<DeltaType, RemoveNodeDelta>)
{ {
assert(my_node); assert(node);
my_node = nullptr; node = nullptr;
my_last_applied_zxid = delta.zxid; last_applied_zxid = delta.zxid;
} }
else if constexpr (std::same_as<DeltaType, UpdateNodeDelta>) else if constexpr (std::same_as<DeltaType, UpdateNodeDelta>)
{ {
assert(my_node); assert(node);
my_node->invalidateDigestCache(); node->invalidateDigestCache();
operation.update_fn(*node); operation.update_fn(*node);
my_last_applied_zxid = delta.zxid; last_applied_zxid = delta.zxid;
} }
else if constexpr (std::same_as<DeltaType, SetACLDelta>) else if constexpr (std::same_as<DeltaType, SetACLDelta>)
{ {
my_acls = operation.acls; acls = operation.acls;
my_last_applied_zxid = delta.zxid; last_applied_zxid = delta.zxid;
} }
}, },
delta.operation); delta.operation);