Fix to Check, at compile time, that ReturnRef action is not operating on
temporaries #2471 Added deleted overload to ::testing::ReturnRef that prevents this funtion from operating on temporaries (T&&)
This commit is contained in:
parent
f966ed1581
commit
9a3f11afb0
|
@ -1022,6 +1022,10 @@ inline internal::ReturnRefAction<R> ReturnRef(R& x) { // NOLINT
|
||||||
return internal::ReturnRefAction<R>(x);
|
return internal::ReturnRefAction<R>(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent creates an action that returns the reference to a variable to operate on temporaries
|
||||||
|
template <typename R>
|
||||||
|
internal::ReturnRefAction<R> ReturnRef(R&& x) = delete;
|
||||||
|
|
||||||
// Creates an action that returns the reference to a copy of the
|
// Creates an action that returns the reference to a copy of the
|
||||||
// argument. The copy is created when the action is constructed and
|
// argument. The copy is created when the action is constructed and
|
||||||
// lives as long as the action.
|
// lives as long as the action.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user