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

            Bug ID: 101687
           Summary: Scoped enumerators of a member enumeration shall not
                    be referred by a class member access expression
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xmh970252187 at gmail dot com
  Target Milestone: ---

struct A{
    enum class C{
        a = 0
    };
};
int main(){
   A a;
   auto c = a.C::a;  //#1
}

> Each enum-name and each unscoped enumerator is declared in the scope that 
> immediately contains the enum-specifier. 

> An enumerator declared in class scope can be referred to using the class 
> member access operators (​::​, . (dot) and -> (arrow)), see [expr.ref].

According to the above rule, A::C::a shouldn't appear in the id-expression of a
member access expression, which means `#1` should be ill-formed.
  • [Bug c++/101687] New: Scoped en... xmh970252187 at gmail dot com via Gcc-bugs

Reply via email to