summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.brendan/visibility3.C
blob: 249ae8116ea9465476bf2807cef4e73fae250d90 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// { dg-do assemble  }
// GROUPS passed visibility
// Used to say:
// manip.cc:17: member `_f' is a private member of class `B<int>'
// manip.cc:17: member `_a' is a private member of class `B<int>'

class A {};

template <class TP>
class B;

template <class TP>
inline A &
operator<< (A &o, const B<TP> &m);

template <class TP>
class B
{
  A &(*_f) (A &, TP);
  TP _a;
public:
  B (A &(*f) (A &, TP), TP a) : _f (f), _a (a) {}
  friend A &operator<< <>(A &o, const B<TP> &m);
};

template <class TP>
inline A &
operator<< (A &o, const B<TP> &m)
{
  (*m._f) (o, m._a);
  return o;
}

A &setw (A &, int);
B<int> setw (int n)
{
  return B<int> (setw, n);
}

A x;

void f ()
{
  x << setw (2);
}