https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123228

--- Comment #2 from Arseniy Orlov <arseny.orlow at yandex dot ru> ---
Created attachment 63174
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63174&action=edit
Issue patch-file

As I understood, the problem is that when checking member accessibility
recursively in cp/search.cc in dfs_walk_once_accessible_r the compiler checks
it from the class that is currently searched for that member rather than from
the class where that private member is actually used:
```
          if (!scope
              || TREE_CODE (scope) == NAMESPACE_DECL
              || !is_friend (BINFO_TYPE (binfo), scope))
            continue;
```
So I believe that the attached fix is sufficient for this issue.

I may send it to [email protected] as well, if necessary.

Reply via email to