Douglas Gregor | 182ddf0 | 2009-09-28 00:08:27 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | d85bea2 | 2009-09-26 06:47:28 +0000 | [diff] [blame] | 2 | |
| 3 | // PR5057 |
| 4 | namespace std { |
| 5 | class X { |
| 6 | public: |
| 7 | template<typename T> |
| 8 | friend struct Y; |
| 9 | }; |
| 10 | } |
| 11 | |
| 12 | namespace std { |
| 13 | template<typename T> |
| 14 | struct Y |
| 15 | { |
| 16 | }; |
| 17 | } |
Douglas Gregor | 182ddf0 | 2009-09-28 00:08:27 +0000 | [diff] [blame] | 18 | |
| 19 | |
| 20 | namespace 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 Gregor | d7e5bdb | 2009-10-09 21:11:42 +0000 | [diff] [blame^] | 31 | |
| 32 | // PR4768 |
| 33 | template<typename T> |
| 34 | struct X0 { |
| 35 | template<typename U> friend struct X0; |
| 36 | }; |
| 37 | |
| 38 | template<typename T> |
| 39 | struct X0<T*> { |
| 40 | template<typename U> friend struct X0; |
| 41 | }; |
| 42 | |
| 43 | template<> |
| 44 | struct X0<int> { |
| 45 | template<typename U> friend struct X0; |
| 46 | }; |