diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-16 05:39:49 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-16 05:39:49 +0000 |
commit | 23010bc8bc657b65d1b0ea5a52f66339c39dc81b (patch) | |
tree | e988ca30c77d6ca9b32595fdbd4b59589db99563 /gcc/cp/semantics.c | |
parent | f3af78f1e7d4bc53f586972a39c1fb6a5c8e3fcf (diff) | |
download | gcc-23010bc8bc657b65d1b0ea5a52f66339c39dc81b.tar.gz |
PR c++/27339
* cp-tree.h (perform_access_checks): New function.
* semantics.c (perform_access_checks): New function.
(perform_deferred_access_checks): Use it.
* parser.c (cp_parser_simple_declaration): Adjust call to
cp_parser_init_declarator.
(cp_parser_type_parameter): Do not defer checks in default
arguments.
(cp_parser_explicit_specialization): Adjust call to
cp_parser_single_declaration.
(cp_parser_init_declarator): Perform template-parameter access
checks.
(cp_parser_parameter_declaration): Do not defer checks for
template parameter default arguments.
(cp_parser_template_declaration_after_export): Gather access
checks for template parameters, and pass them to
cp_parser_single_declaration.
(cp_parser_template_parameter_access_checks): New function.
(cp_parser_single_declaration): Add checks parameter.
PR c++/27339
* g++.dg/parser/access8.C: Adjust error marker.
* g++.dg/template/access17.C: New test.
* g++.dg/template/access18.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113819 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 23ab2d8a132..1e315e2d123 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -261,6 +261,21 @@ pop_to_parent_deferring_access_checks (void) } } +/* Perform the access checks in CHECKS. The TREE_PURPOSE of each node + is the BINFO indicating the qualifying scope used to access the + DECL node stored in the TREE_VALUE of the node. */ + +void +perform_access_checks (tree checks) +{ + while (checks) + { + enforce_access (TREE_PURPOSE (checks), + TREE_VALUE (checks)); + checks = TREE_CHAIN (checks); + } +} + /* Perform the deferred access checks. After performing the checks, we still have to keep the list @@ -280,14 +295,7 @@ pop_to_parent_deferring_access_checks (void) void perform_deferred_access_checks (void) { - tree deferred_check; - - for (deferred_check = get_deferred_access_checks (); - deferred_check; - deferred_check = TREE_CHAIN (deferred_check)) - /* Check access. */ - enforce_access (TREE_PURPOSE (deferred_check), - TREE_VALUE (deferred_check)); + perform_access_checks (get_deferred_access_checks ()); } /* Defer checking the accessibility of DECL, when looked up in |