[Bug c++/70241] New: Enumerators introduced out-of-line by extending an opaque enum definition always get private accessibility

schaub.johannes at googlemail dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 15 13:15:00 GMT 2016


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

            Bug ID: 70241
           Summary: Enumerators introduced out-of-line by extending an
                    opaque enum definition always get private
                    accessibility
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: schaub.johannes at googlemail dot com
  Target Milestone: ---

The following fails to compile. This is a big show-stopper for this feature

// -std=c++11
class A {
public:
   enum B : int;  
};

enum A::B : int {
   x
};

int main() {
   A::x;   
}

Expected output: nothing, but compile
Actual output:

main.cpp: In function 'int main()':
main.cpp:7:4: error: 'A::B x' is private
    x, y
    ^
main.cpp:11:7: error: within this context
    A::x;   
       ^


More information about the Gcc-bugs mailing list