Commit 6493555f by Mark Mitchell Committed by Mark Mitchell

re PR c++/23842 (Incorrect access control context)

	PR c++/23842
	* pt.c (tsubst_default_argument): Do treat default argument
	expressions as occurring in the context of the function called.

	PR c++/23842
	* g++.dg/template/access16.C: New test.

From-SVN: r104224
parent 8abbec47
2005-09-13 Mark Mitchell <mark@codesourcery.com>
PR c++/23842
* pt.c (tsubst_default_argument): Do treat default argument
expressions as occurring in the context of the function called.
2005-09-12 Mark Mitchell <mark@codesourcery.com>
PR c++/23841
......
......@@ -6097,10 +6097,6 @@ tsubst_default_argument (tree fn, tree type, tree arg)
we must be careful to do name lookup in the scope of S<T>,
rather than in the current class. */
push_access_scope (fn);
/* The default argument expression should not be considered to be
within the scope of FN. Since push_access_scope sets
current_function_decl, we must explicitly clear it here. */
current_function_decl = NULL_TREE;
/* The "this" pointer is not valid in a default argument. */
if (cfun)
{
......
2005-09-13 Mark Mitchell <mark@codesourcery.com>
PR c++/23842
* g++.dg/template/access16.C: New test.
2005-09-13 Richard Sandiford <richard@codesourcery.com>
* gfortran.dg/char_pack_2.f90: Increase the vector size.
// PR c++/23842
struct S;
extern S *p;
template <class T> int f(T*, int y = ((T*)p)->x) {
return y;
}
struct S {
private:
int x;
template <class U> friend int f(U*, int);
};
int g() {
return f(p);
}
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