OSDN Git Service

5e9abb0b52a051e50e45225b0037d13ed9eaa431
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / friend.C
1 // Contribued by Gabriel Dos Reis <gdr@codesourcery.com>
2 // Origin: iskey@i100.ryd.student.liu.se
3
4 class ostream;
5 extern ostream& cout;
6
7 template <class T> struct s;
8
9 template <class T>
10 ostream& operator<<(ostream &o, const typename s<T>::t &x)
11 {
12   return o;
13 }
14
15 template <class T>
16 struct s {
17   struct t
18   {
19     friend ostream&
20     operator<<<T>(ostream&, const typename s<T>::t &);
21   };
22   t x;
23 };
24
25 int main()
26 {
27   s<int>::t y;
28   cout << y; // { dg-error "" }
29 }