Title
[tiny] local class and friendship
Status
nad
Section
[class.friend]
Submitter
Gabriel Dos Reis

Created on 2012-11-10.00:00:00 last changed 138 months ago

Messages

Date: 2012-11-10.00:00:00

When we went from C++98 to C++03 we made nested classes implicitly friend of their enclosing classes. We seem to have missed doing the same for local classes defined at member functions scopes.

Mike Miller explained:

Hmm. I think that's already covered by 11p2:

    A member of a class can also access all the names to which the class
    has access.  A local class of a member function may access the same
    names that the member function itself may access.
By the definition of "private" in 11p1, a nested class has access to the private members of the containing class; a member function of the nested class therefore also has access to the private members of the containing class; a local class of such a member function has the same access as the member function; and a member function of the local class has the same access as the local class, the same access as the containing member function, and the same access as the nested class.

History
Date User Action Args
2012-11-10 00:00:00admincreate