class A { public: int i; class A1 { int j; }; }; class B : private A { public: A::i; A::A1; }; void f () { B b; b.i = 1; B::A1 a1; } The above program does not compile with the following messages: t.cpp:15: error: declaration does not declare anything t.cpp: In function ‘void f()’: t.cpp:6: error: ‘class A::A1’ is inaccessible t.cpp:23: error: within this context The C++ standard section 11.3 talks about access declarators. It does not explicitly say that inner classes can be used this way, but nor does it say they cannot. Note that the integer `i' works fine with the same idiom.
Confirmed.
Subject: Bug 29138 Author: mmitchel Date: Tue Oct 3 18:04:10 2006 New Revision: 117409 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117409 Log: PR c++/29138 * decl2.c (grokfield): Don't handle access declarations here. * parser.c (cp_parser_using_declaration): Handle access declarations too. (cp_parser_block_declaration): Adjust calls to cp_parser_using_declaration. (cp_parser_member_declaration): Likewise. Use cp_parser_using_declaration to look for access_declarations. PR c++/29138 * g++.dg/inherit/access8.C: New test. * g++.dg/template/dtor4.C: Tweak error messages. Added: trunk/gcc/testsuite/g++.dg/inherit/access8.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl2.c trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/template/dtor4.C
Subject: Bug 29138 Author: mmitchel Date: Tue Oct 3 18:06:00 2006 New Revision: 117410 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117410 Log: PR c++/29138 * decl2.c (grokfield): Don't handle access declarations here. * parser.c (cp_parser_using_declaration): Handle access declarations too. (cp_parser_block_declaration): Adjust calls to cp_parser_using_declaration. (cp_parser_member_declaration): Likewise. Use cp_parser_using_declaration to look for access_declarations. PR c++/29138 * g++.dg/inherit/access8.C: New test. * g++.dg/template/dtor4.C: Tweak error messages. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/inherit/access8.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/decl2.c branches/gcc-4_1-branch/gcc/cp/parser.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/dtor4.C
Fixed in 4.1.2, 4.2.0.
Subject: Bug 29138 Author: mmitchel Date: Tue Oct 3 18:39:32 2006 New Revision: 117411 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117411 Log: PR c++/29138 * decl2.c (grokfield): Don't handle access declarations here. * parser.c (cp_parser_using_declaration): Handle access declarations too. (cp_parser_block_declaration): Adjust calls to cp_parser_using_declaration. (cp_parser_member_declaration): Likewise. Use cp_parser_using_declaration to look for access_declarations. PR c++/29138 * g++.dg/inherit/access8.C: New test. * g++.dg/template/dtor4.C: Tweak error messages. Modified: trunk/gcc/cp/parser.c
Fixed in GCC-4.1.2.