OSDN Git Service

/cp
[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) // { dg-message "note" }
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   // { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 28 }
30 }