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

--- Comment #2 from Casey Carter <Casey at Carter dot net> ---
[basic.lookup.unqual]/9 says that name *lookup* inside friend functions defined
inline works as it does in member functions, but that doesn’t necessarily imply
that the friend function should have the same *access* as member functions
would to the names so found (excepting, of course, names of the class being
defined). 

Given [class.friend]/2:

Declaring a class to be a friend implies that the names of private and
protected members from the class granting friendship can be accessed in the
base-specifiers and member declarations of the befriended class.

and [class.mem]/1:

… Except when used to declare friends (11.3), to declare an unnamed bit-field
(9.6), or to introduce the name of a member of a base class into a derived
class (7.3.3), or when the declaration is an empty-declaration,
member-declarations declare members of the class, and each such
member-declaration shall declare at least one member name of the class. …

It's "clear" that a friend declaration is a member-declaration which – oddly
enough – does not declare a member. So the critical question is whether the
wording “and member declarations” in [class.friend]/2 means “declarations that
are syntactically member-declarations” or “declarations of members.” I'm
inclined to the second interpretation, which would imply the behavior described
in this bug report is what the standard intends.

Reply via email to