This is the mail archive of the gcc@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]

global scope in friends


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


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