summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/memfriend5.C
blob: 38c2fb93fad34d971c1b1ad4935ed6784ff559e4 (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
// { dg-do compile }

// Copyright (C) 2003 Free Software Foundation
// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>

// Member template function of member class template as friend

template <class T> struct A {
  template <class U> struct B {
    template <class V> void f(V);
  };
};

class X {
  int i;
  template <class T> template <class U> template <class V>
    friend void A<T>::B<U>::f(V);
};

template <class T> template <class U> template <class V>
  void A<T>::B<U>::f(V)
{
  X x;
  x.i = 0;
}

int main()
{
  A<char>::B<char> a1;
  a1.f(0);
}