Commit 8fb08bdd by Mark Mitchell Committed by Mark Mitchell

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
parent 9b126a10
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
......
......@@ -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;
......
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment