This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Templated friends?
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: <gcc at gcc dot gnu dot org>
- Date: Tue, 14 Jan 2003 12:14:22 +0100 (CET)
- Subject: Templated friends?
Hi!
Are we supposed to accept something like
template <class X>
class A {
void bar() const;
template <class Y>
void foo(const A<Y>& a) const {
a.bar();
}
template <class Y>
friend class A;
};
int main(int argc, char **argv)
{
A<int> a;
A<double> b;
a.foo(b);
return 0;
}
The above gives
templatedfirends.cpp:5: error: `void A<X>::foo(const A<Y>&) const [with Y
= double, X = int]' is private
templatedfirends.cpp:16: error: within this context
which is incorrect(?)
Thanks, Richard.
--
Richard Guenther <richard.guenther@uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/