Douglas Gregor | c19ee3e | 2009-06-17 23:37:01 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | 551f48c | 2009-03-27 04:21:56 +0000 | [diff] [blame] | 2 | |
| 3 | class A; |
| 4 | |
| 5 | class S { |
| 6 | public: |
| 7 | template<typename T> struct A { |
| 8 | struct Nested { |
| 9 | typedef T type; |
| 10 | }; |
| 11 | }; |
| 12 | }; |
| 13 | |
| 14 | int i; |
| 15 | S::A<int>::Nested::type *ip = &i; |
| 16 | |
Douglas Gregor | c305833 | 2009-08-24 23:03:25 +0000 | [diff] [blame] | 17 | template<typename T> |
Douglas Gregor | 05396e2 | 2009-08-25 17:23:04 +0000 | [diff] [blame] | 18 | struct Outer { |
| 19 | template<typename U> |
| 20 | class Inner0; |
Douglas Gregor | c305833 | 2009-08-24 23:03:25 +0000 | [diff] [blame] | 21 | |
| 22 | template<typename U> |
Douglas Gregor | 05396e2 | 2009-08-25 17:23:04 +0000 | [diff] [blame] | 23 | class Inner1 { |
| 24 | struct ReallyInner; |
| 25 | |
| 26 | T foo(U); |
| 27 | template<typename V> T bar(V); |
Douglas Gregor | c305833 | 2009-08-24 23:03:25 +0000 | [diff] [blame] | 28 | }; |
| 29 | }; |
| 30 | |
Douglas Gregor | 05396e2 | 2009-08-25 17:23:04 +0000 | [diff] [blame] | 31 | template<typename X> |
| 32 | template<typename Y> |
| 33 | class Outer<X>::Inner0 { |
| 34 | public: |
| 35 | void f(X, Y); |
| 36 | }; |
Douglas Gregor | c305833 | 2009-08-24 23:03:25 +0000 | [diff] [blame] | 37 | |
Douglas Gregor | 05396e2 | 2009-08-25 17:23:04 +0000 | [diff] [blame] | 38 | #if 0 |
| 39 | // FIXME: These don't parse properly because we can't handle the template-name |
| 40 | // "Inner0" or "Inner1" after the dependent type Outer<X>. |
| 41 | template<typename X> |
| 42 | template<typename Y> |
| 43 | void Outer<X>::Inner0<Y>::f(X, Y) { |
| 44 | } |
| 45 | |
| 46 | template<typename X> |
| 47 | template<typename Y> |
| 48 | struct Outer<X>::Inner1<Y>::ReallyInner { |
| 49 | void g(X, Y); |
| 50 | }; |
| 51 | |
| 52 | template<typename X> |
| 53 | template<typename Y> |
| 54 | void Outer<X>::Inner1<Y>::ReallyInner::g(X, Y) { |
| 55 | } |
| 56 | |
| 57 | template<typename X> |
| 58 | template<typename Y> |
| 59 | X Outer<X>::Inner1<Y>::foo(Y) { |
| 60 | return X(); |
| 61 | } |
| 62 | |
| 63 | template<typename X> |
| 64 | template<typename Y> |
| 65 | template<typename Z> |
| 66 | X Outer<X>::Inner1<Y>::bar(Z) { |
| 67 | return X(); |
| 68 | } |
| 69 | #endif |