CWG Issue 2509 (original) (raw)

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

2025-04-13


2509.decl-specifier-seq in lambda-specifiers

Section: 7.5.6.1 [expr.prim.lambda.general]Status: CD6Submitter: Jens MaurerDate: 2021-10-28

[Accepted at the February, 2022 meeting.]

(From editorial issue2338.)

Use of decl-specifier-seq in the production for_lambda-specifiers_ is too general and should be restricted.

Proposed resolution (December, 2021):

  1. Change the grammar in 7.5.6.1 [expr.prim.lambda.general] as follows: lambda-specifiers: decllambda-specifier-seqopt noexcept-specifieropt attribute-specifier-seqopt trailing-return-typeopt lambda-specifier: consteval
    constexpr
    mutable lambda-specifier-seq: lambda-specifier
    lambda-specifier lambda-specifier-seq
  2. Change 7.5.6.1 [expr.prim.lambda.general] paragrap 3 as follows:

In the decl-specifier-seq of the lambda-declarator, each _decl-specifier_shall be one of mutable, constexpr, orconsteval. A _lambda-specifier-seq_shall contain at most one of each _lambda-specifier_and shall not contain both constexpr andconsteval. If the _lambda-declarator_contains an explicit object parameter (9.3.4.6 [dcl.fct]), then no decllambda-specifier in the _decllambda-specifier-seq_shall be mutable.