summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/friend.C
blob: 44cbce938d74d96e4f41f5226d227f608a5fe505 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Contribued by Gabriel Dos Reis <gdr@codesourcery.com>
// Origin: iskey@i100.ryd.student.liu.se

class ostream;
extern ostream& cout;

template <class T> struct s;

template <class T>
ostream& operator<<(ostream &o, const typename s<T>::t &x) // { dg-message "note" }
{
  return o;
}

template <class T>
struct s {
  struct t
  {
    friend ostream&
    operator<<<T>(ostream&, const typename s<T>::t &);
  };
  t x;
};

int main()
{
  s<int>::t y;
  cout << y; // { dg-error "" }
  // { dg-message "candidate" "candidate note" { target *-*-* } 28 }
}