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

            Bug ID: 67943
           Summary: Friend declaration applied to base class, leading to
                    allowing access to protected base
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

gcc 5.2 compiles the following:

struct Base { };
struct Derived : protected Base { };
struct Derived2 : public Derived {
    friend void test();
};

void test() {
    Derived a;
    Base* p = &a;
}

int main(){
    test();
}

If you comment out the friend declaration in Derived2, which should be
irrelevant to the example, then gcc reports an error that Base is an
inaccessible base of Derived.

Reply via email to