BUG: friends get lost in instantiation
Mark Mitchell
mark@markmitchell.com
Fri Oct 16 12:18:00 GMT 1998
This is really bugging me (that bug wasn't there in 1.1b but is in the
19981012 snapshot). I'm using Solaris2.5.1 on an Ultra1 machine.
template <class T> struct A ;
template <class T> int F(A<T>) ;
template <class T>
struct A{
fcn(T) ;
friend int F <>(A) ;
protected:
int a ;
};
int F(A<int> t){
t.a++ ;
}
If you know how to work around this, please let me know. Thanks.
Oops, I didn't read this carefully enough. Your code is broken; you
must say:
template <>
int F(a<int> t) { t.a++; }
if you mean that this function is a template specialization.
Otherwise, it's just an ordinary function, unrelated to the earlier
template declarations.
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com
More information about the Gcc-bugs
mailing list