https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123228
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Arseniy Orlov from comment #2)
> Created attachment 63174 [details]
> 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.
That sounds right. Assuming the fix passes bootstrap+regression testing
(https://gcc.gnu.org/contribute.html#testing), please do send it to gcc-patches
for review (https://gcc.gnu.org/contribute.html#patches).