diff options
| author | Abseil Team <absl-team@google.com> | 2020-08-20 10:50:35 -0400 |
|---|---|---|
| committer | vslashg <gfalcon@google.com> | 2020-08-23 23:51:21 -0400 |
| commit | ec9be15bf8f4789c6d847806e0e8778da67bc216 (patch) | |
| tree | 8f97f389c9bb67d7194dfdf5634da93eba2b81aa /googlemock/include | |
| parent | 655bff5d3873e1e4e9e28411dbc02f16c601ddfa (diff) | |
| download | googletest-ec9be15bf8f4789c6d847806e0e8778da67bc216.tar.gz googletest-ec9be15bf8f4789c6d847806e0e8778da67bc216.zip | |
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/include')
| -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 3aba9ec0..02356a40 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>...)>>( |

