Date
2022-11-20.07:54:16
Message id
3574

Content

The text of 9.8.1 [dcl.enum] paragraph 2 explicitly forbids unnamed scoped enumerations:

The optional identifier shall not be omitted in the declaration of a scoped enumeration.

There does not appear to be a good rationale for this restriction since a typedef name can be used to name the enumerators. It is also inconsistent with similar constructs. For example,

    typedef enum class { e } E;
    E x = E::e;

is ill-formed, but

    typedef struct { enum { s }; } S;
    int y = S::s;

is well-formed.