Googletest export

Workaround static assert in early versions libc++

The error is "Attempted to construct a reference element in a tuple with an
rvalue". We can fix this by putting everything into a non temporary tuple_args
and implitly convert to the other tuple types. This avoids binding an rvalue
reference to an lvalue reference inside the tuple.

PiperOrigin-RevId: 327624990
pull/2994/head
Abseil Team 4 years ago committed by vslashg
parent 655bff5d38
commit ec9be15bf8
  1. 5
      googlemock/include/gmock/gmock-actions.h

@ -1050,10 +1050,11 @@ struct DoAllAction {
std::vector<Action<void(NonFinalType<Args>...)>> converted;
Action<R(Args...)> last;
R operator()(Args... args) const {
auto tuple_args = std::forward_as_tuple(std::forward<Args>(args)...);
for (auto& a : converted) {
a.Perform(std::forward_as_tuple(std::forward<Args>(args)...));
a.Perform(tuple_args);
}
return last.Perform(std::forward_as_tuple(std::forward<Args>(args)...));
return last.Perform(std::move(tuple_args));
}
};
return Op{Convert<Action<void(NonFinalType<Args>...)>>(

Loading…
Cancel
Save