Merge pull request #2527 from PiotrNycz:gmock_prevent_return_ref_to_store_temporaries_2
PiperOrigin-RevId: 277061341
This commit is contained in:
@@ -1052,6 +1052,10 @@ inline internal::ReturnRefAction<R> ReturnRef(R& x) { // NOLINT
|
||||
return internal::ReturnRefAction<R>(x);
|
||||
}
|
||||
|
||||
// Prevent using ReturnRef on reference to temporary.
|
||||
template <typename R, R* = nullptr>
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user