[Bug 45770] (c++) New: global access allowance exceeds that of derived class
MichieldeB at aim dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 23 23:11:00 GMT 2010
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: unassigned@gcc.gnu.org
ReportedBy: MichieldeB@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.
More information about the Gcc-bugs
mailing list