Title
Defining members of local classes
Status
review
Section
11.6 [class.local]
Submitter
Brian Bi

Created on 2024-03-08.00:00:00 last changed 1 month ago

Messages

Date: 2024-06-14.20:31:51

CWG 2024-06-14

The implementation status quo is that no members of local classes other than nested classes can be defined at block scope.

Possible resolution:

Change in 11.6 [class.local] paragraph 3 as follows:

If class X is a local class, a nested class Y may be declared in class X and later defined in the definition of class X or be later defined in the same scope as the definition of class X. A class nested within a local class is a local class. A member of a local class X shall be declared only in the definition of X or, if the member is a nested class, in the nearest enclosing block scope of X.
Date: 2024-06-14.20:31:51

Subclause 11.6 [class.local] paragraph 3 establishes restrictions on the definition of classes nested within local classes, but it is unclear which restrictions exist for other members of local classes.

Possible resolution [SUPERSEDED]:

Change in 11.6 [class.local] paragraph 3 as follows:

If class X is a local class, a nested class Y may be declared in class X and later defined in the definition of class X or be later defined in the same scope as the definition of class X. A class nested within a local class is a local class. A member of a local class X shall be declared only in the definition of X or the nearest enclosing block scope of X.
History
Date User Action Args
2024-06-14 20:31:51adminsetmessages: + msg7737
2024-06-14 20:31:51adminsetstatus: open -> review
2024-03-08 00:00:00admincreate