aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r--gcc/cp/search.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 21d1b77..2af5e04 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -792,11 +792,12 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
if (protected_accessible_p (decl, TREE_VALUE (t), binfo))
return 1;
- /* Nested classes are implicitly friends of their enclosing types, as
+ /* Nested classes have the same access as their enclosing types, as
per core issue 45 (this is a change from the standard). */
if (TYPE_P (scope))
for (t = TYPE_CONTEXT (scope); t && TYPE_P (t); t = TYPE_CONTEXT (t))
- if (protected_accessible_p (decl, t, binfo))
+ if (protected_accessible_p (decl, t, binfo)
+ || friend_accessible_p (t, decl, binfo))
return 1;
if (TREE_CODE (scope) == FUNCTION_DECL