Re: [C++ patch] PR 59482

2014-01-23 Thread Paolo Carlini

Hi,

On 01/22/2014 11:38 PM, Ville Voutilainen wrote:

Oh, I was expecting Jason would do that. Note that Marek Polacek pointed
out two formatting issues:
- comments should have full stop and two spaces at the end

Yes, will fix in my next commit touching that file.

- also two spaces before e-mail in the ChangeLog

I took care of this when I applied the patch.

Thanks,
Paolo.


Re: [C++ patch] PR 59482

2014-01-22 Thread Paolo Carlini

On 01/21/2014 04:24 PM, Jason Merrill wrote:

OK, thanks.
I don't think Ville has Write After Approval, thus I'm going to commit 
this on his behalf.


Thanks,
Paolo.


Re: [C++ patch] PR 59482

2014-01-22 Thread Ville Voutilainen
On 22 January 2014 19:39, Paolo Carlini paolo.carl...@oracle.com wrote:
 On 01/21/2014 04:24 PM, Jason Merrill wrote:

 OK, thanks.

 I don't think Ville has Write After Approval, thus I'm going to commit this
 on his behalf.


Oh, I was expecting Jason would do that. Note that Marek Polacek pointed
out two formatting issues:
- comments should have full stop and two spaces at the end
- also two spaces before e-mail in the ChangeLog


Re: [C++ patch] PR 59482

2014-01-21 Thread Jason Merrill

OK, thanks.

Jason


[C++ patch] PR 59482

2014-01-21 Thread Ville Voutilainen
As analysed in the bug report, the scope for the accessibility
check was incorrect, and hence the friend was not allowed access.
Fixed by pushing into the class scope before parsing the
base-clause, and popping afterwards to let the surrounding
nested-name-specifier popping work correctly.

Tested on x86_64-linux.


pr59482.changelog
Description: Binary data
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c3016bc..3bc943b 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/g++.dg/pr59482.C b/gcc/testsuite/g++.dg/pr59482.C
new file mode 100644
index 000..bde8329
--- /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 {};