This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15308] g++: [3.4 regression] accessing protected data members through pointer-to-member forbidden


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]