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

Created on 2026-05-16.00:00:00 last changed 2 weeks 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-05-16.00:00:00

(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
  }
History
Date User Action Args
2026-06-27 07:05:12adminsetstatus: open -> tentatively ready
2026-05-16 13:34:13adminsetmessages: + msg8580
2026-05-16 00:00:00admincreate