summaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorSimon Martin <simartin@users.sourceforge.net>2006-11-20 21:15:44 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2006-11-20 21:15:44 +0000
commit02022f3a706d462cdb2da30e2d8cfd79901d78ab (patch)
tree49ec524753ca756a93eb724fe929b9e30035943c /gcc/cp/semantics.c
parent903ff2758bdad932eee6ae84539361c18e6c45e9 (diff)
downloadgcc-02022f3a706d462cdb2da30e2d8cfd79901d78ab.tar.gz
re PR c++/29475 (incomplete template diagnostics.)
PR c++/29475 * cp-tree.h (enforce_access, perform_or_defer_access_check): Added an extra argument that represents the declaration to use to print potential error messages. * init.c (build_offset_ref): Adjusted the call to perform_or_defer_access_check. * class.c (alter_access, resolve_address_of_overloaded_function): Likewise. * decl.c (make_typename_type, make_unbound_class_template): Likewise. * search.c (lookup_member): Likewise. * friend.c (add_friend): Likewise. * parser.c (cp_parser_template_id, cp_parser_pre_parsed_nested_name_specifier): Likewise. * semantics.c (finish_non_static_data_member, check_accessibility_of_qualified_id, finish_id_expression): Likewise. (pop_to_parent_deferring_access_checks, perform_access_checks, perform_or_defer_access_check): Adjusted the call to enforce_access. * call.c (enforce_access): Use the new extra argument to build the error message. (build_op_delete_call): Adjusted the call to perform_or_defer_access_check. (build_over_call): Likewise. PR c++/29475 * g++.dg/template/access19.C: New test. * g++.old-deja/g++.other/access11.C: Adjusted the line where the error is reported. From-SVN: r119027
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 91d200a588e..e3dc3ab3ec4 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -234,7 +234,7 @@ pop_to_parent_deferring_access_checks (void)
/* Check access. */
for (; checks; checks = TREE_CHAIN (checks))
enforce_access (TREE_PURPOSE (checks),
- TREE_VALUE (checks));
+ TREE_VALUE (checks), TREE_VALUE (checks));
}
else
{
@@ -271,7 +271,7 @@ perform_access_checks (tree checks)
while (checks)
{
enforce_access (TREE_PURPOSE (checks),
- TREE_VALUE (checks));
+ TREE_VALUE (checks), TREE_VALUE (checks));
checks = TREE_CHAIN (checks);
}
}
@@ -299,10 +299,10 @@ perform_deferred_access_checks (void)
}
/* Defer checking the accessibility of DECL, when looked up in
- BINFO. */
+ BINFO. DIAG_DECL is the declaration to use to print diagnostics. */
void
-perform_or_defer_access_check (tree binfo, tree decl)
+perform_or_defer_access_check (tree binfo, tree decl, tree diag_decl)
{
tree check;
deferred_access *ptr;
@@ -319,7 +319,7 @@ perform_or_defer_access_check (tree binfo, tree decl)
/* If we are not supposed to defer access checks, just check now. */
if (ptr->deferring_access_checks_kind == dk_no_deferred)
{
- enforce_access (binfo, decl);
+ enforce_access (binfo, decl, diag_decl);
return;
}
@@ -1432,7 +1432,8 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
DECL_NAME (decl),
/*template_p=*/false);
- perform_or_defer_access_check (TYPE_BINFO (access_type), decl);
+ perform_or_defer_access_check (TYPE_BINFO (access_type), decl,
+ decl);
/* If the data member was named `C::M', convert `*this' to `C'
first. */
@@ -1511,7 +1512,8 @@ check_accessibility_of_qualified_id (tree decl,
or similar in a default argument value. */
&& CLASS_TYPE_P (qualifying_type)
&& !dependent_type_p (qualifying_type))
- perform_or_defer_access_check (TYPE_BINFO (qualifying_type), decl);
+ perform_or_defer_access_check (TYPE_BINFO (qualifying_type), decl,
+ decl);
}
/* EXPR is the result of a qualified-id. The QUALIFYING_CLASS was the
@@ -2839,7 +2841,7 @@ finish_id_expression (tree id_expression,
tree path;
path = currently_open_derived_class (DECL_CONTEXT (decl));
- perform_or_defer_access_check (TYPE_BINFO (path), decl);
+ perform_or_defer_access_check (TYPE_BINFO (path), decl, decl);
}
decl = convert_from_reference (decl);