summaryrefslogtreecommitdiff
path: root/gcc/cp/friend.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-07 20:36:36 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-07 20:36:36 +0000
commitfd8d6049687e5bc402a0f970df1b7084b7db1893 (patch)
treeb5ba1f06fdf738a4df46fbd5008f64ebb0936d5a /gcc/cp/friend.c
parent0c956d1d5a24137dcb88c9884252a59fa9526279 (diff)
downloadgcc-fd8d6049687e5bc402a0f970df1b7084b7db1893.tar.gz
* cp-tree.h (struct saved_scope): Add incomplete field.
(namespace_scope_incomplete): New macro. * decl.c (pushdecl): Use it. (hack_incomplete_structures): Use it. See through artificial binding levels. (mark_saved_scope): Mark it. Implement access control for nested types. * search.c (type_access_control): New fn. (accessible_p): Now we do perform access control for types. * semantics.c (deferred_type_access_control): New fn. (initial_deferred_type_access_control): New fn. (begin_function_definition): Call it. Add lookups parm. * decl.c (struct binding_level): Add this_class field. (pushlevel_class): Set it. (mark_binding_level): Mark it. (lookup_name_real): Use it. Call type_access_control. (mark_saved_scope): Mark lookups field. * cp-tree.h (flagged_type_tree): Add lookups field. (struct saved_scope): Add lookups field. (type_lookups): New macro. * parse.y (declmods): Now <ftype>. (parse_decl): Add lookups parm. Call initial_deferred_type_access_control. (lang_extdef): Clear type_lookups. (typed_declspecs, declmods, typespec): Set lookups field. (initdcl): Call deferred_type_access_control. (fn.def1, fn.def2, typed_declspecs1, initdcl0_innards, nomods_initdcl0, component_decl_1, named_parm): Adjust. * friend.c (is_friend): Nested classes are friends of their enclosing classes. * class.c (currently_open_derived_class): New fn. * method.c (hack_identifier): Use it. * lex.c (do_identifier): Remove obsolete code. * parse.y (typed_typespecs): Propagate new_type_flag properly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31837 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r--gcc/cp/friend.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index aaeaa8f99ee..ac93bf93250 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -101,8 +101,13 @@ is_friend (type, supplicant)
else
/* It's a type. */
{
- if (type == supplicant)
- return 1;
+ /* The type and its nested classes are implicitly friends, as
+ per core issue 45 (this is a change from the standard). */
+ for (context = supplicant;
+ context && TYPE_P (context);
+ context = TYPE_CONTEXT (context))
+ if (type == context)
+ return 1;
list = CLASSTYPE_FRIEND_CLASSES (TREE_TYPE (TYPE_MAIN_DECL (type)));
for (; list ; list = TREE_CHAIN (list))