diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-03-27 17:33:36 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-03-27 17:33:36 +0000 |
commit | 0c0aac2fecce30d1c71554169446cae25f079234 (patch) | |
tree | 60ca8cc353fd96a0c775f1b61e4833ed942c36b0 /gcc/cp/friend.c | |
parent | f099f336d1933243103b460498b49c7b7314d2be (diff) | |
download | gcc-0c0aac2fecce30d1c71554169446cae25f079234.zip gcc-0c0aac2fecce30d1c71554169446cae25f079234.tar.gz gcc-0c0aac2fecce30d1c71554169446cae25f079234.tar.bz2 |
cp-tree.h (add_friend): Declare.
* cp-tree.h (add_friend): Declare.
(add_friends): Likewise.
* friend.c (add_friend): Make it global. Don't add to
DECL_BEFRIENDING_CLASSES if the befriending class is a template.
(add_friends): Make it global.
(make_friend_class): Don't add to DECL_BEFRIENDING_CLASSES if the
befriending class is a template.
* parse.y (component_decl_1): Fix typo in comment.
* parse.c: Regenerated.
* pt.c (instantiate_class_template): Use add_friend and
add_friends rather that duplicating some of their functionality
here.
From-SVN: r26020
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r-- | gcc/cp/friend.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 2a69acd..285432f 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -27,9 +27,6 @@ Boston, MA 02111-1307, USA. */ #include "output.h" #include "toplev.h" -static void add_friend PROTO((tree, tree)); -static void add_friends PROTO((tree, tree, tree)); - /* Friend data structures are described in cp-tree.h. */ /* Returns non-zero if SUPPLICANT is a friend of TYPE. */ @@ -140,7 +137,7 @@ is_friend (type, supplicant) /* Add a new friend to the friends of the aggregate type TYPE. DECL is the FUNCTION_DECL of the friend being added. */ -static void +void add_friend (type, decl) tree type, decl; { @@ -176,15 +173,16 @@ add_friend (type, decl) DECL_FRIENDLIST (typedecl) = tree_cons (DECL_NAME (decl), build_tree_list (error_mark_node, decl), DECL_FRIENDLIST (typedecl)); - DECL_BEFRIENDING_CLASSES (decl) - = tree_cons (NULL_TREE, type, - DECL_BEFRIENDING_CLASSES (decl)); + if (!uses_template_parms (type)) + DECL_BEFRIENDING_CLASSES (decl) + = tree_cons (NULL_TREE, type, + DECL_BEFRIENDING_CLASSES (decl)); } /* Declare that every member function NAME in FRIEND_TYPE (which may be NULL_TREE) is a friend of type TYPE. */ -static void +void add_friends (type, name, friend_type) tree type, name, friend_type; { @@ -298,9 +296,10 @@ make_friend_class (type, friend_type) = tree_cons (NULL_TREE, friend_type, CLASSTYPE_FRIEND_CLASSES (type)); if (is_template_friend) friend_type = TREE_TYPE (friend_type); - CLASSTYPE_BEFRIENDING_CLASSES (friend_type) - = tree_cons (NULL_TREE, type, - CLASSTYPE_BEFRIENDING_CLASSES (friend_type)); + if (!uses_template_parms (type)) + CLASSTYPE_BEFRIENDING_CLASSES (friend_type) + = tree_cons (NULL_TREE, type, + CLASSTYPE_BEFRIENDING_CLASSES (friend_type)); } } |