This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25427] Impossible to create a friend function for a class in a namespace, outside the namespace.
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Dec 2005 16:23:02 -0000
- Subject: [Bug c++/25427] Impossible to create a friend function for a class in a namespace, outside the namespace.
- References: <bug-25427-11884@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pinskia at gcc dot gnu dot org 2005-12-15 16:23 -------
This is invalid code, Comeau gives the following error:
"ComeauTest.c", line 12: error: the global scope has no "operator<<"
friend std::ostream & :: operator<<(std::ostream &os,A
&a);
^
GCC's error could be better.
Anyways the way to fix it would to add the following before the namespace S:
namespace S{class A;}
std::ostream &operator<<(std::ostream &os,S::A &a);
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25427