This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51757] friend defined inside class and declared inside main linker error


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51757

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2012-01-05
         Resolution|INVALID                     |
     Ever Confirmed|0                           |1

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-05 10:35:56 UTC ---
There is no A::func, that's a friend not a member function. 

[class.friend]

-6-  A function can be defined in a friend declaration of a class if and only
if the class is a non-local class (9.8), the function name is unqualified, and
the function has namespace scope. [ Example:
class M {
  friend void f() { } // definition of global f, a friend of M,
                      // not the definition of a member function
};
âend example ]
-7- Such a function is implicitly inline. A friend function defined in a class
is in the (lexical) scope of the class in which it is defined. A friend
function defined outside the class is not (3.4.1).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]