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

2024-10-26


2890. Defining members of local classes

Section: 11.6  [class.local]     Status: review     Submitter: Brian Bi     Date: 2024-03-08

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.

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.