Date
2018-11-15.00:00:00
Message id
6378

Content

Proposed resolution (November, 2018):

Change 7.5.6.3 [expr.prim.lambda.capture] paragraph 9 as follows:

A lambda-expression appearing in a default argument shall not implicitly or explicitly capture any entity, except for an init-capture for which any full-expression in its initializer satisfies the constraints of an expression appearing in a default argument (9.3.4.7 [dcl.fct.default]). [Example:

  void f2() {
    int i = 1;
    void g1(int = ([i]{ return i; })());       // ill-formed
    void g2(int = ([i]{ return 0; })());       // ill-formed
    void g3(int = ([=]{ return i; })());       // ill-formed
    void g4(int = ([=]{ return 0; })());       // OK
    void g5(int = ([]{ return sizeof i; })()); // OK
    void g6(int = ([x=1] { return x; }))();    // OK
    void g7(int = ([x=i] { return x; }))();    // ill-formed
  }

end example]