This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++ 2.95.2 disallows partially specializated friends
- To: sebor at my-Deja dot com
- Subject: Re: g++ 2.95.2 disallows partially specializated friends
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Wed, 22 Mar 2000 01:16:30 +0100
- CC: gcc-bugs at gcc dot gnu dot org, pedretti at roguewave dot com
- References: <NLFNAOMCFIFBICAA@my-deja.com>
> 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