summaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
authorPiotr Nycz <piotrwn1@gmail.com>2019-10-22 13:58:00 (GMT)
committerPiotr Nycz <piotrwn1@gmail.com>2019-10-22 13:58:00 (GMT)
commitb11fb80e9e94384589037ecd0595b96105906bbc (patch)
tree80362aeff9fb8bda8276093952049efedf8556cf /googlemock
parentf966ed158177f2ed6ff2c402effb16f7f00ca40b (diff)
downloadgoogletest-b11fb80e9e94384589037ecd0595b96105906bbc.zip
googletest-b11fb80e9e94384589037ecd0595b96105906bbc.tar.gz
googletest-b11fb80e9e94384589037ecd0595b96105906bbc.tar.bz2
Prevent using ReturnRef on reference to temporary
Fixed issue: 2471
Diffstat (limited to 'googlemock')
-rw-r--r--googlemock/include/gmock/gmock-actions.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index f12d39b..931e69a 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -1022,6 +1022,10 @@ inline internal::ReturnRefAction<R> ReturnRef(R& x) { // NOLINT
return internal::ReturnRefAction<R>(x);
}
+// Prevent using ReturnRef on reference to temporary.
+template <typename R>
+internal::ReturnRefAction<R> ReturnRef(R&&) = delete;
+
// Creates an action that returns the reference to a copy of the
// argument. The copy is created when the action is constructed and
// lives as long as the action.