This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Backporting to 4_0 the latest friend bits
Mark Mitchell wrote:
Those are somewhat above my pain threshold. Is there something else
that we could do for the 4.0 branch? Like issue a warning and ignore
the friend declaration?
Sorry for long delay. I just got back from a trip (but I will be away
next week as well.) Doing what you suggest, ignoring friend declarations,
would break other valid code now accepted by 4.0 such as below:
class A {};
namespace N {
class B {
friend class A;
// more stuff here
};
class A {
// accessing B private/protected members
};
}
> Am I correct in understand that the problem
> case is that the friend declaration looks like "friend class C" where
> there is a C in a containing scope, but no C in the class with the
> friend declaration?
The problem here is name conflict of C in two different scope
via using declaration/directive.
I see that either the patch (actually only one of the two fixes this issue:
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01283.html ) applied or
leave the current behavior as is. It would do more harm than good
if we try to do something different.
--Kriang