Prevent using ReturnRef on reference to temporary

Fixed issue: 2471
This commit is contained in:
Piotr Nycz 2019-10-22 15:58:00 +02:00
parent f966ed1581
commit b11fb80e9e

View File

@ -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.