This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ - priv
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: g++ - priv
- From: "Maciej Hrebien" <m_hrebien at poczta dot onet dot pl>
- Date: Fri, 16 Mar 2001 19:29:45 +0100
Hi,
I use gcc-2.95.2 package and I think that there is a little bug. Please look
at this:
#include <iostream>
using std::cout;
class A
{
public:
int x;
void fun(){ cout<<"A::fun"<<endl; }
void foo(){ cout<<"A::foo"<<endl; }
};
class B : public A
{
using A::fun;
using A::x;
public:
void foo(){ cout<<"B::foo"<<endl; }
};
main()
{
B b;
b.foo();
b.A::foo();
b.fun(); // !!!
b.x=0; // !!!
return 0;
}
Lines marked as "!!!" are accessing private member and function and the
compiler
doesn't report errors. But even worst: the code is linked, the program is
working but my private members aren't _private_ :(
Maciej Hrebien
--