template parameters cannot be friends

naje najeiv@ukr.net
Fri May 21 12:30:00 GMT 2004


Hello,
would you suggest to me, why gcc 3.3.3 can not compile this:

template<class T>
class Base
{
    friend T;
};

class A:public Base<A>
{
};

# cc test.cpp
test.cpp:6: error: template parameters cannot be friends

while Intel C++, MS VisualC++, gcc 2.95 do.
Does it conflict with C++ standart?
How can i change code to produce such behaviour? (I need eliminate errors like "class A:public Base<B>")
Thank you.



More information about the Gcc-help mailing list