re PR c++/7809 (befriending inaccessible names)

PR c++/7809
	* friend.c (add_friend): Check access for member functions
	and templates.

	* g++.dg/parse/access3.C: New test.

From-SVN: r69513
This commit is contained in:
Kriang Lerdsuwanakij 2003-07-17 15:47:40 +00:00 committed by Kriang Lerdsuwanakij
parent 83a279e492
commit 41c5ee0615
4 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2003-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/7809
* g++.dg/parse/access3.C: New test.
2003-07-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/10668

View File

@ -170,6 +170,9 @@ add_friend (tree type, tree decl)
list = TREE_CHAIN (list);
}
if (DECL_CLASS_SCOPE_P (decl))
perform_or_defer_access_check (TYPE_BINFO (DECL_CONTEXT (decl)), decl);
maybe_add_class_template_decl_list (type, decl, /*friend_p=*/1);
DECL_FRIENDLIST (typedecl)

View File

@ -1,3 +1,9 @@
2003-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/7809
* friend.c (add_friend): Check access for member functions
and templates.
2003-06-17 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/11384

View File

@ -0,0 +1,14 @@
// { dg-do compile }
// Origin: <bagnara@cs.unipr.it>
// PR c++/7809: Befriending inaccessible name.
class A {
private:
void f(); // { dg-error "private" }
};
class B {
friend void A::f(); // { dg-error "context" }
};