diff options
author | Abseil Team <absl-team@google.com> | 2020-08-20 14:50:35 (GMT) |
---|---|---|
committer | vslashg <gfalcon@google.com> | 2020-08-24 03:51:21 (GMT) |
commit | ec9be15bf8f4789c6d847806e0e8778da67bc216 (patch) | |
tree | 8f97f389c9bb67d7194dfdf5634da93eba2b81aa /googlemock | |
parent | 655bff5d3873e1e4e9e28411dbc02f16c601ddfa (diff) | |
download | googletest-ec9be15bf8f4789c6d847806e0e8778da67bc216.zip googletest-ec9be15bf8f4789c6d847806e0e8778da67bc216.tar.gz googletest-ec9be15bf8f4789c6d847806e0e8778da67bc216.tar.bz2 |
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
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index 3aba9ec..02356a4 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/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>...)>>( |