]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/59482 (A friend class cannot inherit a private nested class)
authorVille Voutilainen <ville.voutilainen@gmail.com>
Wed, 22 Jan 2014 18:08:01 +0000 (20:08 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 22 Jan 2014 18:08:01 +0000 (18:08 +0000)
/cp
2014-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>

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  <ville.voutilainen@gmail.com>

PR c++/59482
* g++.dg/pr59482.C: New.

From-SVN: r206933

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr59482.C [new file with mode: 0644]

index 0b9c1812421c7d44ec5637cd02a9239894804ae5..671b36cc193cd3ba8b91013fcf109524be41b761 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       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  <ebotcazou@adacore.com>
 
        * decl2.c (cpp_check): Revert prototype change.
index c3016bcda4b68d75f2455779f399eda314348208..3bc943bd91e661d49b59b57d2444d4da66362b4c 100644 (file)
@@ -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;
 
index 447d3c7401e50f50ddf0b1d3d45b59e01a4d7635..243a7607b7e00b090f2290a712942a5a73bbfdc0 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/59482
+       * g++.dg/pr59482.C: New.
+
 2014-01-22  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * 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 (file)
index 0000000..bde8329
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+class aa { 
+    friend class cc; 
+    class bb {}; 
+}; 
+
+class cc : aa::bb {};