Douglas Gregor | 79c2278 | 2010-01-16 20:21:20 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify %s |
| 2 | template<typename T> |
| 3 | void f0() { |
| 4 | struct X; |
| 5 | typedef struct Y { |
| 6 | T (X::* f1())(int) { return 0; } |
| 7 | } Y2; |
| 8 | |
| 9 | Y2 y = Y(); |
| 10 | } |
| 11 | |
| 12 | template void f0<int>(); |
Douglas Gregor | 26997fd | 2010-01-16 20:52:59 +0000 | [diff] [blame] | 13 | |
| 14 | // PR5764 |
| 15 | namespace PR5764 { |
John McCall | 7002f4c | 2010-04-09 19:03:51 +0000 | [diff] [blame] | 16 | struct X { |
Douglas Gregor | 26997fd | 2010-01-16 20:52:59 +0000 | [diff] [blame] | 17 | template <typename T> |
| 18 | void Bar() { |
Douglas Gregor | 60406be | 2010-01-16 22:29:39 +0000 | [diff] [blame] | 19 | typedef T ValueType; |
John McCall | 7002f4c | 2010-04-09 19:03:51 +0000 | [diff] [blame] | 20 | struct Y { |
Douglas Gregor | 60406be | 2010-01-16 22:29:39 +0000 | [diff] [blame] | 21 | Y() { V = ValueType(); } |
| 22 | |
| 23 | ValueType V; |
Douglas Gregor | 26997fd | 2010-01-16 20:52:59 +0000 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | Y y; |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | void test(X x) { |
| 31 | x.Bar<int>(); |
| 32 | } |
| 33 | } |
| 34 | |
Chandler Carruth | 17e0f40 | 2010-02-15 22:12:26 +0000 | [diff] [blame] | 35 | // Instantiation of local classes with virtual functions. |
| 36 | namespace local_class_with_virtual_functions { |
| 37 | template <typename T> struct X { }; |
| 38 | template <typename T> struct Y { }; |
| 39 | |
| 40 | template <typename T> |
| 41 | void f() { |
| 42 | struct Z : public X<Y<T>*> { |
| 43 | virtual void g(Y<T>* y) { } |
| 44 | void g2(int x) {(void)x;} |
| 45 | }; |
| 46 | Z z; |
| 47 | (void)z; |
| 48 | } |
| 49 | |
| 50 | struct S { }; |
| 51 | void test() { f<S>(); } |
| 52 | } |