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

            Bug ID: 90324
           Summary: Accessibility: nested enum defined outside of class
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alex at webprise dot net
  Target Milestone: ---

Test case:

class C {
   enum E: int;
   typedef int T;
};

enum C::E: C::T {
   X, Y, Z = X,
};

Error messages:

<source>:6:15: error: 'typedef int C::T' is private within this context

 enum C::E: C::T {

               ^

<source>:3:16: note: declared private here

    typedef int T;

                ^

<source>:7:14: error: 'C::E X' is private within this context

    X, Y, Z = X,

              ^

<source>:7:4: note: declared private here

    X, Y, Z = X,

    ^

Compiler options:
-pedantic -std=c++11
(but probably not relevant at all)

clang++ and icpc compile this just fine.

Version(s):
I can reproduce it with almost any version, starting from 4.9 up to trunk.

Relevant Standard wording (ISO/IEC 14882:2011, 11p6):
All access controls in Clause 11 affect the ability to access a class member
name from the declaration of a particular entity, including parts of the
declaration preceding the name of the entity being declared and, if the
entity is a class, the definitions of members of the class appearing outside
the class’s member-specification.

I believe that both issues (accessibility in the underlying type
specification and enumerator specifications) are related. Hence, I am
submitting this as a single issue.

Doubts: Is my test-case standard-compliant? Is this rather an obscure
part of ISO/IEC 14882:2011 (and subsequent specs)?

Reply via email to