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] New: g++: [3.4 regression] accessing protected data members through pointer-to-member forbidden


The subject says it all. 
 
--------------------- 
class A 
{ 
protected: 
    int x; 
}; 
 
class B : public A 
{ 
public: 
    int A::* y; 
    void xxx(); 
}; 
 
 
void B::xxx() 
{ 
    y = &A::x; 
} 
----------------------- 
 
[kirr@tugrik tmp]$ g++ -Wall -c 340-inheritance.cpp  
340-inheritance.cpp: In member function `void B::xxx()': 
340-inheritance.cpp:4: error: `int A::x' is protected 
340-inheritance.cpp:17: error: within this context 
 
[kirr@tugrik tmp]$ g++ -v 
Reading specs from /usr/local/gcc-3.4.0-check/lib/gcc/i686-pc-linux-gnu/3.4.0/specs 
Configured with: ../gcc-3.4.0/configure --prefix=/usr/local/gcc-3.4.0-check --with-gnu-as 
--with-gnu-ld --enable-threads=posix --with-arch=i686 --with-tune=pentium4 
--enable-__cxa_atexit --enable-languages=c,c++,f77 --enable-checking --disable-nls 
Thread model: posix 
gcc version 3.4.0

-- 
           Summary: g++: [3.4 regression] accessing protected data members
                    through pointer-to-member forbidden
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: smelkov at mph1 dot phys dot spbu dot ru
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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]