https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106756
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[13 Regression] Overbroad |[CWG1699] Overbroad |friendship for nested |friendship for nested |classes |classes Last reconfirmed| |2022-09-12 Ever confirmed|0 |1 Status|UNCONFIRMED |SUSPENDED --- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to S. Davis Herring from comment #2) > That said, one can make a similar argument along the lines of "B is a > member-declaration of A, and so f is part of a member-declaration itself", Exactly. > which puts us back on the old question of whether it matters whether the > friend is defined inside the class. Indeed, GCC still rejects the example > modified to use > > int f(A::B*) {return A::i;} Yes, because there the definition of f is not (part of) a member-declaration. Friends defined in the class body are different in various ways from normal functions that happen to be friends; it makes sense to me for this to be one such. Suspending pending the resolution of CWG1699.