diff options
author | Abseil Team <absl-team@google.com> | 2019-09-25 22:40:52 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2019-09-27 20:48:33 (GMT) |
commit | cb3f7ce1deef5084306c929528a9728afdb17164 (patch) | |
tree | 1e25e13562a6eabd76d9ba4abc0d1832927e09c1 /googlemock/include/gmock/gmock-matchers.h | |
parent | a783ade7c2448d7feabe9874aecf8c83b67422c0 (diff) | |
download | googletest-cb3f7ce1deef5084306c929528a9728afdb17164.zip googletest-cb3f7ce1deef5084306c929528a9728afdb17164.tar.gz googletest-cb3f7ce1deef5084306c929528a9728afdb17164.tar.bz2 |
Googletest export
Makes testing::ResultOf() work with non-copyable arguments.
PiperOrigin-RevId: 271222632
Diffstat (limited to 'googlemock/include/gmock/gmock-matchers.h')
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index bf9eb20..28e188b 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -1858,7 +1858,9 @@ struct CallableTraits { static void CheckIsValid(Functor /* functor */) {} template <typename T> - static auto Invoke(Functor f, T arg) -> decltype(f(arg)) { return f(arg); } + static auto Invoke(Functor f, const T& arg) -> decltype(f(arg)) { + return f(arg); + } }; // Specialization for function pointers. @@ -1889,7 +1891,7 @@ class ResultOfMatcher { template <typename T> operator Matcher<T>() const { - return Matcher<T>(new Impl<T>(callable_, matcher_)); + return Matcher<T>(new Impl<const T&>(callable_, matcher_)); } private: |