This is the mail archive of the gcc-patches@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: Qualified friends


> Can we fix this by using set_decl_namespace, say?  I'd prefer to avoid
> messing with global variables like this if possible.

We already use set_decl_namespace. Unfortunately, in the example

void foo();

namespace M{
class C{
  friend void ::foo();
};
}

this has no effect. DECL_CONTEXT of foo is set to NULL to indicate the
global namespace. pushdecl (as called from do_friend) will think that
the namespace has not been set, and set it to current namespace
(i.e. M).

One solution would be to indicate :: as context with DECL_CONTEXT ==
global_namespace, but I had it this way a year ago, and the we changed
it.

Please advise me of other alternatives.

Regards,
Martin


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