template parameters cannot be friends

llewelly@xmission.com llewelly@xmission.com
Fri May 21 15:08:00 GMT 2004


"naje" <najeiv@ukr.net> writes:

> Hello,
> would you suggest to me, why gcc 3.3.3 can not compile this:
> 
> template<class T>
> class Base
> {
>     friend T;

typedefs and template parameters are not allowed to be friends. 14.5.3
    describes the constructs allowed in a friend declaration in a
    class template, and typedefs and template parameters are not
    amoung them.

I think this is unfortunate, but it's rare to need this feature.

> };
[snip]



More information about the Gcc-help mailing list