------- Comment #1 from chris dot fairles at gmail dot com 2008-08-13 15:32 ------- You're simply trying to access a protected member variable which is not allowed. It doesn't matter if you try to access it from a member function of a sub-object of A; if you have an object of type A, and it has a protected member var i, you cannot access it directly. If foo() took a type C, or only tried to access "i" (the protected member var of A from which C inherits) as opposed to a.i, then it will compile as expected.
HTH, Chris -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37112