This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51757] friend defined inside class and declared inside main linker error
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Jan 2012 10:35:56 +0000
- Subject: [Bug c++/51757] friend defined inside class and declared inside main linker error
- Auto-submitted: auto-generated
- References: <bug-51757-4@http.gcc.gnu.org/bugzilla/>
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).