This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


775. Capturing references to functions

Section:  [expr.prim.lambda.capture]     Status: CD2     Submitter: Steve Adamczyk     Date: 12 February, 2009

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

According to 7.5.5 [expr.prim.lambda] paragraph 8, the “object type” of a captured function is the type to which the reference refers. That's clearly wrong when the captured reference is a reference to a function, because the resulting data member of the closure class will have a function type:

    void f() { }
    void g() {
      void (&fr)() = f;
      [fr]{};   // Oops...

Proposed resolution (July, 2009)

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