aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@gcc.gnu.org>1998-06-11 20:11:55 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>1998-06-11 20:11:55 +0000
commit112a70c24da0534355071de477c0b69e17e27eed (patch)
tree36c4051274c9f9a3742f80d82925579291b68e42 /gcc
parent67fe9f06fa8fa6fc46228b42dc260ea8ac12fcd2 (diff)
downloadgcc-112a70c24da0534355071de477c0b69e17e27eed.zip
gcc-112a70c24da0534355071de477c0b69e17e27eed.tar.gz
gcc-112a70c24da0534355071de477c0b69e17e27eed.tar.bz2
friend.c (do_friend): Add support for nested classes using member functions of the enclosing class as...
8 * friend.c (do_friend): Add support for nested classes using member functions of the enclosing class as friends. egcs bug From-SVN: r20433
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/friend.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index c6f68bd..e36d306 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -344,13 +344,16 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
if (is_friend_template)
decl = DECL_TI_TEMPLATE (push_template_decl (decl));
- if (TYPE_SIZE (ctype) != 0
- && template_class_depth (ctype) == 0)
+ if (TYPE_SIZE (ctype) != 0 && template_class_depth (ctype) == 0)
decl = check_classfn (ctype, decl);
+ /* TYPE_BEING_DEFINED is a hack for nested classes having
+ member functions of the enclosing class as friends. Will
+ go away as parsing of classes gets rewritten. */
if (TREE_TYPE (decl) != error_mark_node)
{
- if (TYPE_SIZE (ctype) || template_class_depth (ctype) > 0)
+ if (TYPE_BEING_DEFINED (ctype) ||
+ TYPE_SIZE (ctype) || template_class_depth (ctype) > 0)
add_friend (current_class_type, decl);
else
cp_error ("member `%D' declared as friend before type `%T' defined",