qobjectdefs.h: properly disable rvalue qReturnArg()
template <typename T> qReturnArg(T&&) is an unconstrained perfect forwarder, and will "win" for everything for which `T&` is not an equal match. e.g. a volatile T. Restrict the deleted overload to actual rvalues. We don't need to use `const volatile T&&`, because rvalues never bind to `T&`, we just need to get off using a universal reference, and adding const does that. As a drive-by, change the deleted overload's return type to void, to mimic std::as_const(), the prototype for rvalue-deleted function overloads. Change-Id: If4fbc311677b993488859b2c4e226b94daed71fe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit c6dbae9550e3819a3e1ade1bf06f5d9cb030d561) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
ce56402bce
commit
aec4a7d1fd
@ -216,7 +216,7 @@ template <typename... Args> inline auto invokeMethodHelper(QMetaMethodReturnArgu
|
||||
}
|
||||
} // namespace QtPrivate
|
||||
|
||||
template <typename T> inline QMetaMethodReturnArgument qReturnArg(T &&) = delete;
|
||||
template <typename T> void qReturnArg(const T &&) = delete;
|
||||
template <typename T> inline QMetaMethodReturnArgument qReturnArg(T &data)
|
||||
{
|
||||
return QtPrivate::Invoke::returnArgument(nullptr, data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user