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

2026-05-20


3192. Out-of-line definition of an enum member of a local class

Section: 11.6  [class.local]     Status: open     Submitter: Victor Chernyakin     Date: 2026-05-16

(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
  }

Suggested resolution:

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.