Commit 25903d03 by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

semantics.c (perform_deferred_access_checks): Don't discard checked access.

	* semantics.c (perform_deferred_access_checks): Don't discard
	checked access.

	* g++.dg/parse/access2.C: New test.

From-SVN: r66925
parent 8849fb49
2003-05-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* semantics.c (perform_deferred_access_checks): Don't discard
checked access.
2003-05-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
......
......@@ -234,7 +234,21 @@ void pop_to_parent_deferring_access_checks (void)
pop_deferring_access_checks ();
}
/* Perform the deferred access checks. */
/* Perform the deferred access checks.
After performing the checks, we still have to keep the list
`deferred_access_stack->deferred_access_checks' since we may want
to check access for them again later in a different context.
For example:
class A {
typedef int X;
static X a;
};
A::X A::a, x; // No error for `A::a', error for `x'
We have to perform deferred access of `A::X', first with `A::a',
next with `x'. */
void perform_deferred_access_checks (void)
{
......@@ -245,9 +259,6 @@ void perform_deferred_access_checks (void)
/* Check access. */
enforce_access (TREE_PURPOSE (deferred_check),
TREE_VALUE (deferred_check));
/* No more deferred checks. */
deferred_access_stack->deferred_access_checks = NULL_TREE;
}
/* Defer checking the accessibility of DECL, when looked up in
......
2003-05-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* g++.dg/parse/access2.C: New test.
2003-05-17 Mark Mitchell <mark@codesourcery.com>
* lib/gcc-dg.exp (gcc-dg-debug-runtest): New method.
......
// Copyright (C) 2003 Free Software Foundation
// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
// { dg-do compile }
// Deferred access checking of variable declaration.
class A {
typedef int X; // { dg-error "private" }
static X a, b, c;
};
A::X A::a;
A::X A::b, x; // { dg-error "this context" }
A::X y, A::c; // { dg-error "this context" }
A::X z; // { dg-error "this context" }
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