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

            Bug ID: 89025
           Summary: Wrong point of declaration for enumeration names
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Per [basic.scope.pdecl]/3,

> The point of declaration for an enumeration is immediately after 
> the identifier (if any) in either its enum-specifier ([dcl.enum])
> or its first opaque-enum-declaration ([dcl.enum]), whichever comes first.

GCC appears to treat the enumeration as undeclared until after the enum-base:

template<class> using int_ = int;

enum E : int_<E> {}; // should be OK, but error

using E1 = long;

namespace {
    enum E1 : E1 {}; // should be error, but accepted
}

Reply via email to