diff options
author | Mark Mitchell <mark@markmitchell.com> | 1998-07-28 16:50:16 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1998-07-28 16:50:16 +0000 |
commit | 8fb08bdddfb1f19debb76262e8afb99d39a789ea (patch) | |
tree | b79ade80c1954652445f03992bacbac7ee25370a | |
parent | 9b126a10257844bbed01fecc3a557f5fa23f3ed1 (diff) | |
download | gcc-8fb08bdddfb1f19debb76262e8afb99d39a789ea.zip gcc-8fb08bdddfb1f19debb76262e8afb99d39a789ea.tar.gz gcc-8fb08bdddfb1f19debb76262e8afb99d39a789ea.tar.bz2 |
friend.c (is_friend): Be lenient with member functions to deal with nested friends.
* friend.c (is_friend): Be lenient with member functions to deal
with nested friends.
From-SVN: r21444
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/friend.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/friend3.C | 23 |
3 files changed, 37 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f1cd93e..db4baa1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1998-07-28 Mark Mitchell <mark@markmitchell.com> + + * friend.c (is_friend): Be lenient with member functions to deal + with nested friends. + 1998-07-28 Jason Merrill <jason@yorick.cygnus.com> * class.c (finish_struct_1): Convert integer_zero_node to diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 4bd0b08..5a97766 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -77,8 +77,15 @@ is_friend (type, supplicant) friendship. This is bogus in general since two specializations of a template with non-type template parameters may have the same type, but - be different. */ - if (flag_guiding_decls + be different. + + Temporarily, we are also more lenient to deal + with nested friend functions, for which there can + be more than one FUNCTION_DECL, despite being the + same function. When that's fixed, the + FUNCTION_MEMBER_P bit can go. */ + if ((flag_guiding_decls + || DECL_FUNCTION_MEMBER_P (supplicant)) && comptypes (TREE_TYPE (supplicant), TREE_TYPE (TREE_VALUE (friends)), 1)) return 1; diff --git a/gcc/testsuite/g++.old-deja/g++.other/friend3.C b/gcc/testsuite/g++.old-deja/g++.other/friend3.C new file mode 100644 index 0000000..84c6b2d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/friend3.C @@ -0,0 +1,23 @@ +// Build don't link: + +class foo { +public: + class bar; + void func(bar *); + class bar { + int st; + friend void foo::func(bar *); + }; +}; + + +void foo::func(bar *obj) { + obj->st++; +} + +void test02() { + foo obj_f; + foo::bar obj_b; + + obj_f.func( &obj_b); +} |