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
This commit is contained in:
Abseil Team 2020-08-20 10:50:35 -04:00 committed by vslashg
parent 655bff5d38
commit ec9be15bf8

View File

@ -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>...)>>(