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


1927. Lifetime of temporaries in init-captures

Section:  [expr.prim.lambda.capture]     Status: dup     Submitter: Daveed Vandevoorde     Date: 2014-05-14

The current Standard is not clear regarding the lifetime of a temporary created in the initializer of an init-capture:

  void g() {
    struct S { S(int); ~S(); };
    auto x = (S(1), [y = S(2)]{}, S(3));

Is the initializer for y considered a full-expression, or does the S(2) temporary persist until the end of the complete x initializer?

Reationale (June, 2014):

This issue is a duplicate of issue 1695.