diff options
author | Jason Merrill <jason@redhat.com> | 2015-08-19 21:45:49 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-08-19 21:45:49 -0400 |
commit | 7ac2c0bd17900b3c0e078479b46de64563a16c9f (patch) | |
tree | b65582f3511b73960f319ef3ff55d38d73013c57 /gcc/cp/friend.c | |
parent | 18c4fa8ef0c5e3d705be8f50860b3e58be672256 (diff) | |
download | gcc-7ac2c0bd17900b3c0e078479b46de64563a16c9f.zip gcc-7ac2c0bd17900b3c0e078479b46de64563a16c9f.tar.gz gcc-7ac2c0bd17900b3c0e078479b46de64563a16c9f.tar.bz2 |
re PR c++/66957 (incorrect "is protected within this context" error)
PR c++/66957
* search.c (protected_accessible_p): Remove redundant access_in_type.
Add otype parm instead of walking binfo.
(friend_accessible_p): Check SCOPE itself. Handle class
templates. Pass through otype.
(dfs_accessible_post): Handle all accessibility cases.
(dfs_accessible_pre): New.
(accessible_p): Use it. Don't check protected access here. Pass
decl and otype to dfs_walk.
(member_declared_in_type, dfs_access_in_type_pre): New.
(access_in_type): Use dfs_access_in_type_pre.
* friend.c (add_friend): Fix multiple friends with the same name.
From-SVN: r227023
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r-- | gcc/cp/friend.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index e107cee..f53ce27 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -156,11 +156,9 @@ add_friend (tree type, tree decl, bool complain) } } - maybe_add_class_template_decl_list (type, decl, /*friend_p=*/1); - TREE_VALUE (list) = tree_cons (NULL_TREE, decl, TREE_VALUE (list)); - return; + break; } list = TREE_CHAIN (list); } @@ -172,9 +170,10 @@ add_friend (tree type, tree decl, bool complain) maybe_add_class_template_decl_list (type, decl, /*friend_p=*/1); - DECL_FRIENDLIST (typedecl) - = tree_cons (DECL_NAME (decl), build_tree_list (NULL_TREE, decl), - DECL_FRIENDLIST (typedecl)); + if (!list) + DECL_FRIENDLIST (typedecl) + = tree_cons (DECL_NAME (decl), build_tree_list (NULL_TREE, decl), + DECL_FRIENDLIST (typedecl)); if (!uses_template_parms (type)) DECL_BEFRIENDING_CLASSES (decl) = tree_cons (NULL_TREE, type, |