From b11fb80e9e94384589037ecd0595b96105906bbc Mon Sep 17 00:00:00 2001 From: Piotr Nycz Date: Tue, 22 Oct 2019 15:58:00 +0200 Subject: Prevent using ReturnRef on reference to temporary Fixed issue: 2471 --- googlemock/include/gmock/gmock-actions.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'googlemock/include/gmock') diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index f12d39be..931e69a7 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -1022,6 +1022,10 @@ inline internal::ReturnRefAction ReturnRef(R& x) { // NOLINT return internal::ReturnRefAction(x); } +// Prevent using ReturnRef on reference to temporary. +template +internal::ReturnRefAction 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. -- cgit v1.2.3