This seems to be similar to a really old bug on one of the mailing lists,
assuming that it's actually a bug:
class A
{
protected:
void f(){}
};
class B :
public A
{
int c;
};
class C :
public B
{
protected:
void f()
{
A::f(); // ok - see http://gcc.gnu.org/ml/gcc-bugs/1997-10/msg00221.html
&A::f; // error here
}
};
int main ()
{
C x;
}
# g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --with-tune=pentium4 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu3)
--
Summary: Legal program rejection - protected base method
addressing fails from grandchild class
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Simon80 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26838