Title
Out-of-line definition of an enum member of a local class
Status
ready
Section
11.6 [class.local]
Submitter
Victor Chernyakin

Created on 2026-05-16.00:00:00 last changed 1 week ago

Messages

Date: 2026-06-27.07:05:12

Proposed resolution (approved by CWG 2026-06-26):

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

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 an enumeration or a nested class, in the nearest enclosing block scope of X.
Date: 2026-11-19.09:46:28

(From submission #907.)

Consider:

  void f() {
    struct X {
      struct S;
      enum E : int;
    };
    struct X::S {};         // OK
    enum X::E : int {};     // ill-formed, but all major implementations accept
  }

See issue 1485 for general concerns about defining an unscoped enumeration outside of the class definition.

History
Date User Action Args
2026-11-19 09:46:28adminsetstatus: tentatively ready -> ready
2026-06-27 07:05:12adminsetstatus: open -> tentatively ready
2026-05-16 13:34:13adminsetmessages: + msg8580
2026-05-16 00:00:00admincreate