This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-02-07


763. Is a closure object's operator() inline?

Section: 7.5.5.2  [expr.prim.lambda.closure]     Status: CD2     Submitter: Daveed Vandevoorde     Date: 6 February, 2009

[Voted into the WP at the July, 2009 meeting as part of N2927.]

A lambda expression appearing in local scope presumably creates a local class (in the sense of 11.6 [class.local]) as the type of the closure object, because that class is “considered to be defined at the point where the lambda expression occurs” (7.5.5 [expr.prim.lambda] paragraph 7), and in the absence of any indication to the contrary that class must satisfy the restrictions of 11.6 [class.local] on local classes. One such restriction is that all its member functions must be defined within the class definition, making them inline. However, nothing is said about whether the function call operator for a non-local closure class is inline, and even for the local case it would be better if the specification were explicit.

Proposed resolution (July, 2009)

See document PL22.16/09-0117 = WG21 N2927.