aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/friend-template.cpp
blob: 9a483aeb5b1e8ba9b2fc6147ad7bbe8fe0fb2106 (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
46
// RUN: clang-cc -fsyntax-only -verify %s

// PR5057
namespace std {
  class X {
  public:
    template<typename T>
    friend struct Y;
  };
}

namespace std {
  template<typename T>
  struct Y
  {
  };
}


namespace N {
  template<typename T> void f1(T) { } // expected-note{{here}}

  class X {
    template<typename T> friend void f0(T);
    template<typename T> friend void f1(T);
  };

  template<typename T> void f0(T) { }
  template<typename T> void f1(T) { } // expected-error{{redefinition}}
}

// PR4768
template<typename T>
struct X0 {
  template<typename U> friend struct X0;
};

template<typename T>
struct X0<T*> {
  template<typename U> friend struct X0;
};

template<>
struct X0<int> {
  template<typename U> friend struct X0;
};