This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15308] g++: [3.4 regression] accessing protected data members through pointer-to-member forbidden
- From: "smelkov at mph1 dot phys dot spbu dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 May 2004 08:08:36 -0000
- Subject: [Bug c++/15308] g++: [3.4 regression] accessing protected data members through pointer-to-member forbidden
- References: <20040506075356.15308.smelkov@mph1.phys.spbu.ru>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From smelkov at mph1 dot phys dot spbu dot ru 2004-05-06 08:08 -------
it seems to be a more general problem:
------------------
class A
{
protected:
void do_smth();
};
class B : public A
{
public:
void B_do_smth();
};
void B::B_do_smth()
{
do_smth();
this->do_smth();
static_cast<A*>(this)->do_smth();
}
--------------------
[kirr@tugrik tmp]$ g++ -Wall -c 340-inheritance2.cpp
340-inheritance2.cpp: In member function `void B::B_do_smth()':
340-inheritance2.cpp:4: error: `void A::do_smth()' is protected
340-inheritance2.cpp:19: error: within this context
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15308