Douglas Gregor | d0c8737 | 2009-05-27 17:30:49 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | 2bba76b | 2009-05-27 17:07:49 +0000 | [diff] [blame] | 2 | |
| 3 | namespace N { |
| 4 | struct Outer { |
| 5 | struct Inner { |
| 6 | template<typename T> |
| 7 | struct InnerTemplate { |
| 8 | struct VeryInner { |
| 9 | typedef T type; |
| 10 | |
| 11 | static enum K1 { K1Val = sizeof(T) } Kind1; |
Douglas Gregor | 8dbc3c6 | 2009-05-27 17:20:35 +0000 | [diff] [blame] | 12 | static enum { K2Val = sizeof(T)*2 } Kind2; |
Douglas Gregor | d0c8737 | 2009-05-27 17:30:49 +0000 | [diff] [blame] | 13 | enum { K3Val = sizeof(T)*2 } Kind3; |
Douglas Gregor | 2bba76b | 2009-05-27 17:07:49 +0000 | [diff] [blame] | 14 | |
| 15 | void foo() { |
| 16 | K1 k1 = K1Val; |
| 17 | Kind1 = K1Val; |
| 18 | Outer::Inner::InnerTemplate<type>::VeryInner::Kind2 = K2Val; |
Douglas Gregor | d0c8737 | 2009-05-27 17:30:49 +0000 | [diff] [blame] | 19 | Kind3 = K3Val; |
Douglas Gregor | 2bba76b | 2009-05-27 17:07:49 +0000 | [diff] [blame] | 20 | } |
Douglas Gregor | d0c8737 | 2009-05-27 17:30:49 +0000 | [diff] [blame] | 21 | |
| 22 | struct UeberInner { |
| 23 | void bar() { |
| 24 | K1 k1 = K1Val; |
| 25 | Kind1 = K1Val; |
| 26 | Outer::Inner::InnerTemplate<type>::VeryInner::Kind2 = K2Val; |
Douglas Gregor | ed961e7 | 2009-05-27 17:54:46 +0000 | [diff] [blame] | 27 | |
| 28 | InnerTemplate t; |
| 29 | InnerTemplate<type> t2; |
Douglas Gregor | d0c8737 | 2009-05-27 17:30:49 +0000 | [diff] [blame] | 30 | } |
| 31 | }; |
Douglas Gregor | 2bba76b | 2009-05-27 17:07:49 +0000 | [diff] [blame] | 32 | }; |
| 33 | }; |
| 34 | }; |
| 35 | }; |
| 36 | } |
| 37 | |
| 38 | typedef int INT; |
| 39 | template struct N::Outer::Inner::InnerTemplate<INT>::VeryInner; |
Douglas Gregor | d0c8737 | 2009-05-27 17:30:49 +0000 | [diff] [blame] | 40 | template struct N::Outer::Inner::InnerTemplate<INT>::UeberInner; // expected-error{{'UeberInner' does not name a tag member}} |
Douglas Gregor | 6569d68 | 2009-05-27 23:11:45 +0000 | [diff] [blame^] | 41 | |
| 42 | namespace N2 { |
| 43 | struct Outer2 { |
| 44 | template<typename T> |
| 45 | struct Inner { |
| 46 | void foo() { |
| 47 | enum { K1Val = sizeof(T) } k1; |
| 48 | enum K2 { K2Val = sizeof(T)*2 }; |
| 49 | |
| 50 | K2 k2 = K2Val; |
| 51 | |
| 52 | Inner i1; |
| 53 | i1.foo(); |
| 54 | Inner<T> i2; |
| 55 | i2.foo(); |
| 56 | } |
| 57 | }; |
| 58 | }; |
| 59 | } |
| 60 | |
| 61 | // FIXME: template struct N2::Outer2::Inner<float>; |