http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45770

           Summary: global access allowance exceeds that of derived class
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: michiel...@aim.com


// g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
// Copyright (C) 2009 Free Software Foundation, Inc.
// This is free software; see the source for copying conditions.  There is NO
// warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

class A
{

friend class B;

public:
  A(int i) { a = i; }

private:
  A() { a = 0; }
  int a;

};

class B : private A // making protected will eliminate the below problem
{

public:
  B(int i) : A () { a = i >> 1; b = i & 1; }

private:
  bool b;

};

class C : public B
{

public:
  C() : B(4) { A foo(3); } // functions of B may not have local variables A

};             

main () { A bar(3); } // main may have local variables A

-- 
Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Reply via email to