Title
Generic lambdas do not have a template parameter scope
Status
open
Section
6.4.9 [basic.scope.temp]
Submitter
Brian Bi

Created on 2024-12-03.00:00:00 last changed 2 weeks ago

Messages

Date: 2024-12-06.08:06:30

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 ]

Date: 2024-12-03.00:00:00

(From submission #648.)

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

History
Date User Action Args
2024-12-06 08:06:30adminsetmessages: + msg7911
2024-12-03 00:00:00admincreate