aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/friend21.C
blob: 3f690a4404aa16ed461c183554d960ef446e0c41 (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
// Build don't link:

template <class T> struct A {
  static void f();
};

template <class T> class B
{
  friend class A<T>;
  static int i; // ERROR - private
};

template <class T> class C
{
  template <class U>
  friend class A;

  static int i;
};

template <class T>
void A<T>::f()
{
  B<T>::i = 3;
  C<T>::i = 3;
  C<double>::i = 3;
  B<double>::i = 3; // ERROR - member `i' is private
}

template void A<int>::f(); // ERROR - instantiated from here