https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122568

--- Comment #1 from Vincent X <gulackeg at gmail dot com> ---
Another test case demonstrating GCC's different handling of
elaborated-type-specifiers in alias-declarations (with `using`) versus
simple-declarations (with `typedef`):

    // https://godbolt.org/z/hKjhqx4T4

    // ✔ - GCC:
    //     - warning: elaborated-type-specifier for a scoped enum must not
    //       use the 'class' keyword
    //     - error: use of enum 'E' without previous declaration
    typedef enum class E E7; // #7

    // ✗ - GCC: OK
    using E8 = enum class E; // #8

    // ✔ - GCC: warning: elaborated-type-specifier for a scoped enum must not
    //     use the 'class' keyword
    typedef enum class E E9;

Specifically:
- #8 does not emit the warning for the non-standard usage of
  `enum class E`, unlike #7.
- #8 introduces the name `E` into the containing scope automatically,
  whereas #7 requires a forward declaration.

Reply via email to