This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Voted into WP at March, 2010 meeting as document N3055.]
The status of rvalue references to functions is not clear in thecurrent wording. For example, 7.2.1 [basic.lval] paragraph 2says,
An lvalue refers to an object or function. Some rvalueexpressions—those of (possibly cv-qualified) class or arraytype—also refer to objects. [Footnote: Expressions suchas invocations of constructors and of functions that return a classtype refer to objects, and the implementation can invoke a memberfunction upon such objects, but the expressions are not lvalues.—end footnote]
This would tend to indicate that there are no rvalues of functiontype. However, Clause 7 [expr] paragraph 6 says,
If an expression initially has the type “rvalue reference toT” (9.3.4.3 [dcl.ref], 9.5.4 [dcl.init.ref]), thetype is adjusted to “T” prior to any further analysis, andthe expression designates the object or function denoted by the rvaluereference. If the expression is the result of calling a function,whether implicitly or explicitly, it is an rvalue; otherwise, it is anlvalue.
This explicitly indicates that rvalue references to functions arepossible and that, in some cases, they yield function-typed rvalues.Furthermore, _N2914_.20.2.4 [concept.operator] paragraph 20 describes theconceptCallable as:
auto concept Callable<typename F, typename... Args> { typename result_type; result_type operator()(F&, Args...); result_type operator()(F&&, Args...); }It would be strange ifCallable were satisfied for afunction object type but not for a function type.
However, assuming that rvalue references to functions areintended to be supported, it is not clear how an rvalue of functiontype is supposed to behave. For instance, 7.6.1.3 [expr.call] paragraph 1says,
For an ordinary function call, the postfix expression shall be eitheran lvalue that refers to a function (in which case thefunction-to-pointer standard conversion (7.3.4 [conv.func]) issuppressed on the postfix expression), or it shall have pointer tofunction type.
From this, it appears that an rvalue of function type cannot beused in a function call. It can't be converted to a pointer tofunction, either, as 7.3.4 [conv.func] paragraph 1 says,
An lvalue of function typeT can be converted to an rvalue oftype “pointer toT.” The result is a pointer tothe function.
(See also issues664 and especially690. The approach described in the latterissue, viewing rvalue references as essentially lvalues rather thanas essentially rvalues, could resolve the specification problemsdescribed above by eliminating the concept of an rvalue of functiontype.)
Proposed resolution (February, 2010):
See paper N3030.