This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Moved to DR at the April, 2013 meeting.]
According to _N4868_.9.8.2.3 [namespace.memdef] paragraph 3,
Every name first declared in a namespace is a member of thatnamespace. If afriend declaration in a non-local class firstdeclares a class or function95 the friend class or functionis a member of the innermost enclosing namespace. The name of thefriend is not found by unqualified lookup (6.5.3 [basic.lookup.unqual])or by qualified lookup (6.5.5 [basic.lookup.qual]) until a matchingdeclaration is provided in that namespace scope (either before orafter the class definition granting friendship).
Taken literally, that would mean the following example isill-formed:
namespace N { struct A { friend int f(); }; } int N::f() { return 0; } int i = N::f(); // ill-formed:N::f not foundbecause the definition ofN::f appears in global scoperather than in namespace scope.
Proposed resolution (October, 2012):
Change _N4868_.9.8.2.3 [namespace.memdef] paragraph 3 as follows:
Every name first declared in a namespace is a member of thatnamespace. If afriend declaration in a non-local class firstdeclares a class or function95 the friend class or functionis a member of the innermost enclosing namespace.The name of thefriend is not found byThefriend declaration doesnot by itself make the name visible to unqualified lookup(6.5.3 [basic.lookup.unqual]) orbyqualified lookup(6.5.5 [basic.lookup.qual]). [Note: The name of thefriend will be visible in its namespace ifuntilamatching declaration is providedin thatatnamespace scope (either before or after the class definition grantingfriendship).—end note] If a friend functionis called...