This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1333. Missing forwarding during std::function invocation

Section: 19.14.14.2.4 [func.wrap.func.inv] Status: C++11 Submitter: Daniel Krügler Opened: 2010-03-26 Last modified: 2016-12-23

Priority: Not Prioritized

View all other issues in [func.wrap.func.inv].

View all issues with C++11 status.

Discussion:

The current wording of 19.14.14.2.4 [func.wrap.func.inv]/1:

R operator()(ArgTypes... args) const

Effects: INVOKE(f, t1, t2, ..., tN, R) (20.8.2), where f is the target object (20.8.1) of *this and t1, t2, ..., tN are the values in args....

uses an unclear relation between the actual args and the used variables ti. It should be made clear, that std::forward has to be used to conserve the expression lvalueness.

[ Post-Rapperswil: ]

Moved to Tentatively Ready after 5 positive votes on c++std-lib.

[ Adopted at 2010-11 Batavia ]

Proposed resolution:

Change 19.14.14.2.4 [func.wrap.func.inv]/1+2 as indicated:

R operator()(ArgTypes... args) const

1 Effects:: INVOKE(f, std::forward<ArgTypes>(args)...t1, t2, ..., tN, R) (20.8.2), where f is the target object (20.8.1) of *this and t1, t2, ..., tN are the values in args....

2 Returns: Nothing if R is void, otherwise the return value of INVOKE(f, std::forward<ArgTypes>(args)...t1, t2, ..., tN, R).

3 Throws: bad_function_call if !*this; otherwise, any exception thrown by the wrapped callable object.