diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-28 10:41:19 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-28 10:41:19 +0000 |
commit | c344b0fed7ab145b046e6bb19343becf02e5199e (patch) | |
tree | cf4f78ec248da873e1e177db29f5cbdcd3a378fd /gcc/cp/friend.c | |
parent | 97c118b966257fcd0109a228c3e96128b433d301 (diff) | |
download | gcc-c344b0fed7ab145b046e6bb19343becf02e5199e.tar.gz |
* friend.c (add_friend): Only perform access checks when context
is a class.
* lex.c (cxx_make_type): Only create a binfo for aggregate types.
* parser.c (cp_parser_class_specifier): Disable access checks here
when parsing the body of a templated class.
* semantics.c (perform_or_defer_access_checks): Reorder to allow
NULL binfos when not checking access.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83771 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r-- | gcc/cp/friend.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index faf558c4245..75551a9678e 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -129,6 +129,7 @@ add_friend (tree type, tree decl, bool complain) tree typedecl; tree list; tree name; + tree ctx; if (decl == error_mark_node) return; @@ -163,12 +164,9 @@ add_friend (tree type, tree decl, bool complain) list = TREE_CHAIN (list); } - if (DECL_CLASS_SCOPE_P (decl)) - { - tree class_binfo = TYPE_BINFO (DECL_CONTEXT (decl)); - if (!uses_template_parms (BINFO_TYPE (class_binfo))) - perform_or_defer_access_check (class_binfo, decl); - } + ctx = DECL_CONTEXT (decl); + if (ctx && CLASS_TYPE_P (ctx) && !uses_template_parms (ctx)) + perform_or_defer_access_check (TYPE_BINFO (ctx), decl); maybe_add_class_template_decl_list (type, decl, /*friend_p=*/1); |