Debian Codegraph @

gcc/testsuite/g++.dg/template/friend.C

raw
1 // Contribued by Gabriel Dos Reis <[email protected]>
2 // Origin: [email protected]
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 *-*-* } .-1 }
30 }