Commit ca9e1382 by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/9970 (previously declared inline friend can't access members)

	PR c++/9970
	* decl.c (duplicate_decls): Only copy DECL_THUNKS for virtual
	functions.

	* g++.dg/lookup/friend1.C: New test.

From-SVN: r64029
parent c5979bc6
2003-03-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/9970
* decl.c (duplicate_decls): Only copy DECL_THUNKS for virtual
functions.
2003-03-08 Geoffrey Keating <geoffk@apple.com>
* lang-specs.h (c++-header): Change .pch to .gch.
......
......@@ -3554,7 +3554,10 @@ duplicate_decls (tree newdecl, tree olddecl)
DECL_BEFRIENDING_CLASSES (newdecl)
= chainon (DECL_BEFRIENDING_CLASSES (newdecl),
DECL_BEFRIENDING_CLASSES (olddecl));
DECL_THUNKS (newdecl) = DECL_THUNKS (olddecl);
/* DECL_THUNKS is only valid for virtual functions,
otherwise it is a DECL_FRIEND_CONTEXT. */
if (DECL_VIRTUAL_P (newdecl))
DECL_THUNKS (newdecl) = DECL_THUNKS (olddecl);
}
}
......
2003-03-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/9970
* g++.dg/lookup/friend1.C: New test.
2003-03-08 Mark Mitchell <mark@codesourcery.com>
PR c++/9823
......
// { dg-do compile }
// Origin: <matz@suse.de>
// PR c++/9970: In-class friend function definition after
// declaration lexical scope problem.
void f();
struct X
{
enum { k = 1 };
friend void f() {
char a[k];
}
};
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