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

MichieldeB at aim dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |

--- Comment #2 from MichieldeB at aim dot com 2010-09-24 21:53:56 UTC ---
// If the access of locals should be inherited, then the following is a bug.

// 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 allow local variables A below
{

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 have local variables ::A
                             // but not A
};             

template <class T, class U> class D : private T
{
  D(int i) : T(i) { U u; } 
};  

template class D<A,A>; // local A gets global access rights

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