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: g++ 2.95.2 disallows partially specializated friends


> g++ 2.95.s rejects friend declarations of partial class
> specializations. I don't see anything in 14.5.3 that disallows this
> (14.5.3, p1 says that "A friend of a class or class template can be
> ... a specialization of a ... class template ...") - is this an
> unimplemented feature, a bug, or have I missed something? (Other
> conforming compilers such as edg 2.42 or HP aCC 3.14.10 accept the
> code.)

Thanks for your bug report. Without any deeper analysis: What exactly
do you want this code to mean? If you want to make the global template
a friend, then you can write

template <class T, class U>
struct A;


template <class T>
struct A<int, T>
{
    class B {
        friend struct ::A;
    };
};

Without that, 'A' identifies the injected class name, which is the
partial specialization. g++ rejects it on the basis of

      /* [temp.friend]
	 
	 Friend declarations shall not declare partial
	 specializations.  */

Now, I this is certainly a declaration. What does it declare? A
specialization? It certainly refers to one. If you don't think this
answer is satisfying, please discuss the problem in comp.std.c++
first.

Regards,
Martin

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