Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only %s |
Douglas Gregor | 37d93e9 | 2009-08-02 23:24:31 +0000 | [diff] [blame] | 2 | |
| 3 | // PR4607 |
| 4 | template <class T> struct X {}; |
| 5 | |
| 6 | template <> struct X<char> |
| 7 | { |
| 8 | static char* g(); |
| 9 | }; |
| 10 | |
| 11 | template <class T> struct X2 {}; |
| 12 | |
| 13 | template <class U> |
| 14 | struct X2<U*> { |
| 15 | static void f() { |
| 16 | X<U>::g(); |
| 17 | } |
| 18 | }; |
| 19 | |
| 20 | void a(char *a, char *b) {X2<char*>::f();} |
Douglas Gregor | 13c8577 | 2010-05-06 00:28:52 +0000 | [diff] [blame] | 21 | |
| 22 | namespace WonkyAccess { |
| 23 | template<typename T> |
| 24 | struct X { |
| 25 | int m; |
| 26 | }; |
| 27 | |
| 28 | template<typename U> |
| 29 | class Y; |
| 30 | |
| 31 | template<typename U> |
| 32 | struct Y<U*> : X<U> { }; |
| 33 | |
| 34 | template<> |
| 35 | struct Y<float*> : X<float> { }; |
| 36 | |
| 37 | int f(Y<int*> y, Y<float*> y2) { |
| 38 | return y.m + y2.m; |
| 39 | } |
| 40 | } |
Douglas Gregor | c746937 | 2011-05-04 21:55:00 +0000 | [diff] [blame] | 41 | |
| 42 | // <rdar://problem/9169404> |
| 43 | namespace rdar9169404 { |
| 44 | template<typename T, T N> struct X { }; |
| 45 | template<bool C> struct X<bool, C> { |
| 46 | typedef int type; |
| 47 | }; |
| 48 | |
| 49 | X<bool, -1>::type value; |
| 50 | } |