From: Ville Voutilainen Date: Wed, 22 Jan 2014 18:08:01 +0000 (+0200) Subject: re PR c++/59482 (A friend class cannot inherit a private nested class) X-Git-Tag: releases/gcc-4.9.0~1459 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32ab58b2a067db7571934d55fc1aaed80d23f5b3;p=thirdparty%2Fgcc.git re PR c++/59482 (A friend class cannot inherit a private nested class) /cp 2014-01-22 Ville Voutilainen PR c++/59482 * parser.c (cp_parser_class_head): Push the class before parsing the base-clause, pop after it. /testsuite 2014-01-22 Ville Voutilainen PR c++/59482 * g++.dg/pr59482.C: New. From-SVN: r206933 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0b9c1812421c..671b36cc193c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-01-22 Ville Voutilainen + + PR c++/59482 + * parser.c (cp_parser_class_head): Push the class before parsing + the base-clause, pop after it. + 2014-01-20 Eric Botcazou * decl2.c (cpp_check): Revert prototype change. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c3016bcda4b6..3bc943bd91e6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -19845,7 +19845,17 @@ cp_parser_class_head (cp_parser* parser, /* Get the list of base-classes, if there is one. */ if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) - bases = cp_parser_base_clause (parser); + { + /* PR59482: enter the class scope so that base-specifiers are looked + up correctly */ + if (type) + pushclass (type); + bases = cp_parser_base_clause (parser); + /* PR59482: get out of the previously pushed class scope so that the + subsequent pops pop the right thing */ + if (type) + popclass (); + } else bases = NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 447d3c7401e5..243a7607b7e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-01-22 Ville Voutilainen + + PR c++/59482 + * g++.dg/pr59482.C: New. + 2014-01-22 Bill Schmidt * gcc.dg/vmx/insert-vsx-be-order.c: New. diff --git a/gcc/testsuite/g++.dg/pr59482.C b/gcc/testsuite/g++.dg/pr59482.C new file mode 100644 index 000000000000..bde832909fe4 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr59482.C @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +class aa { + friend class cc; + class bb {}; +}; + +class cc : aa::bb {};