Douglas Gregor | f187420f | 2009-06-17 23:37:01 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | fdca4a7 | 2009-03-27 04:21:56 +0000 | [diff] [blame] | 2 | class A; |
| 3 | |
| 4 | class S { |
| 5 | public: |
| 6 | template<typename T> struct A { |
| 7 | struct Nested { |
| 8 | typedef T type; |
| 9 | }; |
| 10 | }; |
| 11 | }; |
| 12 | |
| 13 | int i; |
| 14 | S::A<int>::Nested::type *ip = &i; |
| 15 | |
Douglas Gregor | a3dff8e | 2009-08-24 23:03:25 +0000 | [diff] [blame] | 16 | template<typename T> |
Douglas Gregor | 1d5e9f9 | 2009-08-25 17:23:04 +0000 | [diff] [blame] | 17 | struct Outer { |
| 18 | template<typename U> |
| 19 | class Inner0; |
Douglas Gregor | a3dff8e | 2009-08-24 23:03:25 +0000 | [diff] [blame] | 20 | |
| 21 | template<typename U> |
Douglas Gregor | 1d5e9f9 | 2009-08-25 17:23:04 +0000 | [diff] [blame] | 22 | class Inner1 { |
| 23 | struct ReallyInner; |
| 24 | |
| 25 | T foo(U); |
| 26 | template<typename V> T bar(V); |
Douglas Gregor | e861bac | 2009-08-25 22:51:20 +0000 | [diff] [blame^] | 27 | template<typename V> T* bar(V); |
Douglas Gregor | a3dff8e | 2009-08-24 23:03:25 +0000 | [diff] [blame] | 28 | }; |
| 29 | }; |
| 30 | |
Douglas Gregor | 1d5e9f9 | 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 | a3dff8e | 2009-08-24 23:03:25 +0000 | [diff] [blame] | 37 | |
Douglas Gregor | 1d5e9f9 | 2009-08-25 17:23:04 +0000 | [diff] [blame] | 38 | template<typename X> |
| 39 | template<typename Y> |
| 40 | void Outer<X>::Inner0<Y>::f(X, Y) { |
| 41 | } |
| 42 | |
| 43 | template<typename X> |
| 44 | template<typename Y> |
| 45 | struct Outer<X>::Inner1<Y>::ReallyInner { |
| 46 | void g(X, Y); |
| 47 | }; |
| 48 | |
| 49 | template<typename X> |
| 50 | template<typename Y> |
| 51 | void Outer<X>::Inner1<Y>::ReallyInner::g(X, Y) { |
| 52 | } |
| 53 | |
| 54 | template<typename X> |
| 55 | template<typename Y> |
| 56 | X Outer<X>::Inner1<Y>::foo(Y) { |
| 57 | return X(); |
| 58 | } |
| 59 | |
| 60 | template<typename X> |
| 61 | template<typename Y> |
| 62 | template<typename Z> |
| 63 | X Outer<X>::Inner1<Y>::bar(Z) { |
| 64 | return X(); |
| 65 | } |
Douglas Gregor | e861bac | 2009-08-25 22:51:20 +0000 | [diff] [blame^] | 66 | |
| 67 | template<typename X> |
| 68 | template<typename Y> |
| 69 | template<typename Z> |
| 70 | X* Outer<X>::Inner1<Y>::bar(Z) { |
| 71 | return 0; |
| 72 | } |