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]

Re: problem with friend and namespaces


> Is there a problem with friend declarations inside namespaces or with the
> support of the '::' operator ?

Thanks for your bug report. This is indeed a known bug in g++. Please
note that there is an inherent ambiguity in C++, also. If you have

  friend A::B::f();

is that

  friend A ::B::f(); //function f in namespace B returning A

or

  friend A::B ::f(); //global function f returning A::B

This is no problem in your example, but it should give you an idea
about the parsing problems that arise. I had a patch fixing your case
at one time, but it broke other (more important) cases. As a result,
you cannot have qualified names in a friend declaration in g++, sorry.
If somebody volunteers to rewrite the C++ parser, there'd be a chance
that this bug would get fixed as well.

Regards,
Martin


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