Commit 23ff7e2d by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/19258 (Incorrect access check for default argument)

	PR c++/19258
	* pt.c (push_access_scope): Handle friend defined in class.
	(pop_access_scope): Likewise.

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

From-SVN: r92993
parent d8987adb
2005-01-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/19258
* pt.c (push_access_scope): Handle friend defined in class.
(pop_access_scope): Likewise.
2005-01-06 Nathan Sidwell <nathan@codesourcery.com>
PR c++/19270
......
......@@ -176,7 +176,9 @@ push_access_scope (tree t)
gcc_assert (TREE_CODE (t) == FUNCTION_DECL
|| TREE_CODE (t) == VAR_DECL);
if (DECL_CLASS_SCOPE_P (t))
if (DECL_FRIEND_CONTEXT (t))
push_nested_class (DECL_FRIEND_CONTEXT (t));
else if (DECL_CLASS_SCOPE_P (t))
push_nested_class (DECL_CONTEXT (t));
else
push_to_top_level ();
......@@ -201,7 +203,7 @@ pop_access_scope (tree t)
saved_access_scope = TREE_CHAIN (saved_access_scope);
}
if (DECL_CLASS_SCOPE_P (t))
if (DECL_FRIEND_CONTEXT (t) || DECL_CLASS_SCOPE_P (t))
pop_nested_class ();
else
pop_from_top_level ();
......
2005-01-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/19258
* g++.dg/lookup/friend6.C: New test.
2005-01-06 Nathan Sidwell <nathan@codesourcery.com>
PR c++/19270
......
// { dg-do compile }
// Origin: Matt Austern <austern@apple.com>
// PR c++/19258: Wrong lookup scope for friend defined in class.
class X {
template<class T> friend int ff(T*, int y=anX.x) { return y; }
int f() { return ff(&anX); }
static X anX;
int x;
};
X dummy;
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