Title
Which parameter-declaration-clause in a lambda-expression?
Status
tentatively ready
Section
7.5.5.2 [expr.prim.lambda.closure]
Submitter
Dinka Ranns

Created on 2014-07-16.00:00:00 last changed 1 month ago

Messages

Date: 2023-02-07.00:36:19

Proposed resolution (approved by CWG 2023-02-06):

  1. Change in 7.5.5.2 [expr.prim.lambda.closure] paragraph 3 as follows:

    The closure type for a lambda-expression has a public inline function call operator (for a non-generic lambda) or function call operator template (for a generic lambda) (12.4.4 [over.call]) whose parameters and return type are described by those of the lambda-expression's parameter-declaration-clause and trailing-return-type respectively, and whose template-parameter-list consists of the specified template-parameter-list, if any.
  2. Change in 7.5.5.1 [expr.prim.lambda.general] paragraph 5 as follows:

    If a lambda-declarator does not include a parameter-declaration-clause, it is as if () were inserted at the start of the lambda-declarator. A lambda-expression's parameter-declaration-clause is the parameter-declaration-clause of the lambda-expression's lambda-declarator, if any, or empty otherwise. If the lambda-declarator does not include a trailing-return-type, the lambda return type is auto, which is deduced from return statements as described in 9.2.9.6 [dcl.spec.auto].
Date: 2023-02-07.00:32:42

Suggested resolution [SUPERSEDED]:

Change in 7.5.5.1 [expr.prim.lambda.general] paragraph 5 as follows:

If a lambda-declarator does not include a start with a parenthesized parameter-declaration-clause, it is as if () were inserted at the start of the lambda-declarator. A lambda-expression's parameter-declaration-clause is the (possibly empty) parameter-declaration-clause of the lambda-expression's lambda-declarator. If the lambda-declarator does not include a trailing-return-type, the lambda return type is auto, which is deduced from return statements as described in 9.2.9.6 [dcl.spec.auto].
Date: 2022-04-02.22:01:31

According to 7.5.5.2 [expr.prim.lambda.closure] paragraph 3,

The closure type for a lambda-expression has a public inline function call operator (for a non-generic lambda) or function call operator template (for a generic lambda) (12.4.4 [over.call]) whose parameters and return type are described by the lambda-expression's parameter-declaration-clause and trailing-return-type respectively, and whose template-parameter-list consists of the specified template-parameter-list, if any.

This is insufficiently precise because the trailing-return-type might itself contain a parameter-declaration-clause.

History
Date User Action Args
2023-02-07 00:36:19adminsetstatus: review -> tentatively ready
2023-02-07 00:32:42adminsetmessages: + msg7160
2022-11-20 07:54:16adminsetstatus: open -> review
2022-04-02 22:01:31adminsetmessages: + msg6787
2022-04-02 22:01:31adminsetstatus: drafting -> open
2014-07-16 00:00:00admincreate