for (auto it = callbacks_.cbegin(); it != callbacks_.cend();) {
auto current = *(it++);
RETURN_IF_NOT_OK(current->cb_(args...));
}
return absl::OkStatus();
}
it expands to
for (auto it = callbacks_.cbegin(); it != callbacks_.cend();) {
auto current = *(it++);
if(!current->cb_(args...).ok()) {
return current->cb_(args...); // ---> POTENTIAL BUG here
}
}
return absl::OkStatus();
}
the statement current->cb_(args...); in invoked twice may lead to potential bug.
In the invocation of the macro RETURN_IF_NOT_OK in the following code snippet, extracted from envoy/source/common/common/callback_impl.h:52
it expands to
the statement
current->cb_(args...);
in invoked twice may lead to potential bug.