blob: 761c13076d2ab03a739c152d33591f49f252b11a [file] [log] [blame]
Douglas Gregor182ddf02009-09-28 00:08:27 +00001// RUN: clang-cc -fsyntax-only -verify %s
Douglas Gregord85bea22009-09-26 06:47:28 +00002
3// PR5057
4namespace std {
5 class X {
6 public:
7 template<typename T>
8 friend struct Y;
9 };
10}
11
12namespace std {
13 template<typename T>
14 struct Y
15 {
16 };
17}
Douglas Gregor182ddf02009-09-28 00:08:27 +000018
19
20namespace N {
21 template<typename T> void f1(T) { } // expected-note{{here}}
22
23 class X {
24 template<typename T> friend void f0(T);
25 template<typename T> friend void f1(T);
26 };
27
28 template<typename T> void f0(T) { }
29 template<typename T> void f1(T) { } // expected-error{{redefinition}}
30}
Douglas Gregord7e5bdb2009-10-09 21:11:42 +000031
32// PR4768
33template<typename T>
34struct X0 {
35 template<typename U> friend struct X0;
36};
37
38template<typename T>
39struct X0<T*> {
40 template<typename U> friend struct X0;
41};
42
43template<>
44struct X0<int> {
45 template<typename U> friend struct X0;
46};
Douglas Gregora735b202009-10-13 14:39:41 +000047
48template<typename T>
49struct X1 {
50 template<typename U> friend void f2(U);
51 template<typename U> friend void f3(U);
52};
53
54template<typename U> void f2(U);
55
56X1<int> x1i;
57
58template<> void f2(int);
59
60// FIXME: Should this declaration of f3 be required for the specialization of
61// f3<int> (further below) to work? GCC and EDG don't require it, we do...
62template<typename U> void f3(U);
63
64template<> void f3(int);