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

2024-12-19


2965. Generic lambdas do not have a template parameter scope

Section: 6.4.9  [basic.scope.temp]     Status: open     Submitter: Brian Bi     Date: 2024-12-03

(From submission #648.)

A generic lambda does not have its own template parameter scope. Add a note to highlight this surprising fact.

Suggested resolution:

Change in 6.4.9 [basic.scope.temp] paragraph 2 as follows:

Each template-declaration D introduces a template parameter scope that extends from the beginning of its template-parameter-list to the end of the template-declaration. Any declaration outside the template-parameter-list that would inhabit that scope instead inhabits the same scope as D. The parent scope of any scope S that is not a template parameter scope is the smallest scope that contains S and is not a template parameter scope.

[Note 1: Therefore, only template parameters belong to a template parameter scope, and only template parameter scopes have a template parameter scope as a parent scope. —end note]

[ Note: The optional template-parameter-list of a lambda-expression (7.5.6 [expr.prim.lambda]) does not introduce a template parameter scope. -- end note ]