This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
global scope in friends
- To: egcs at cygnus dot com
- Subject: global scope in friends
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Thu, 4 Feb 1999 08:38:29 +0100
- Cc: mes at ooc dot com, loewis at informatik dot hu-berlin dot de
Recently, somebody reported a bug where
void foo();
class Test{
friend void ::foo();
};
was rejected by egcs: the global scope was not expected here. I could
not find anything in the standard that made this construct illegal.
In an attempt to fix that, I came up with the following interesting
example:
struct A{
struct B{};
};
A::B C();
namespace B{
A C();
}
class Test{
friend A::B::C();
};
Unless I'm overlooking something, this has two possible
interpretations:
friend A ::B::C();
friend A::B ::C();
Is it me, or is it C++?
Any comments appreciated,
Martin