I hate to be circular, but an rvalue reference to function type is an rvalue reference to function type. There is such a thing as a function type, e.g. void ()
. And you can form an rvalue reference to it.
In terms of the classification system introduced by N3055, it is an xvalue.
Its uses are rare and obscure, but it is not useless. Consider for example:
void f() {}
...
auto x = std::ref(f);
x
has type:
std::reference_wrapper<void ()>
And if you look at the synopsis for reference_wrapper
it includes:
reference_wrapper(T&) noexcept;
reference_wrapper(T&&) = delete; // do not bind to temporary objects
In this example T
is the function type void ()
. And so the second declaration forms an rvalue reference to function type for the purpose of ensuring that reference_wrapper
can't be constructed with an rvalue argument. Not even if T
is const.
If it were not legal to form an rvalue reference to function, then this protection would result in a compile time error even if we did not pass an rvalue T
to the constructor.