This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with binary member and friend operator in template class


On 1/30/06, John Love-Jensen  wrote:
>
> Try this:
> template <typename T2> friend P<T2> operator+(T2, const P<T2>&); // line 15

1) Can a template be a friend ? I always thought that only concrete
instantiations
of template can be declared as friend.

2) By the way, "friend" in c++.
I think (I currently have no access to compiler), that in gcc-4.0.2 :
class B{};
class A{
  typedef B BB;
  friend BB;
};
won't be accepted, although gcc-3.36 did accept this.
If true, why ?

Thank you.
Dima.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]