aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/gmock/gmock-matchers.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h
index 822337b1..58fe3b63 100644
--- a/include/gmock/gmock-matchers.h
+++ b/include/gmock/gmock-matchers.h
@@ -1833,7 +1833,7 @@ class MatcherAsPredicate {
template <typename M>
class PredicateFormatterFromMatcher {
public:
- explicit PredicateFormatterFromMatcher(const M& m) : matcher_(m) {}
+ explicit PredicateFormatterFromMatcher(M m) : matcher_(internal::move(m)) {}
// This template () operator allows a PredicateFormatterFromMatcher
// object to act as a predicate-formatter suitable for using with
@@ -1873,10 +1873,11 @@ class PredicateFormatterFromMatcher {
// A helper function for converting a matcher to a predicate-formatter
// without the user needing to explicitly write the type. This is
// used for implementing ASSERT_THAT() and EXPECT_THAT().
+// Implementation detail: 'matcher' is received by-value to force decaying.
template <typename M>
inline PredicateFormatterFromMatcher<M>
-MakePredicateFormatterFromMatcher(const M& matcher) {
- return PredicateFormatterFromMatcher<M>(matcher);
+MakePredicateFormatterFromMatcher(M matcher) {
+ return PredicateFormatterFromMatcher<M>(internal::move(matcher));
}
// Implements the polymorphic floating point equality matcher, which matches