blob: e49d330f63d41ad0f8e7cfa051cd8af0a77ac499 [file] [log] [blame]
Douglas Gregord0c87372009-05-27 17:30:49 +00001// RUN: clang-cc -fsyntax-only -verify %s
Douglas Gregor2bba76b2009-05-27 17:07:49 +00002namespace N {
3 struct Outer {
4 struct Inner {
5 template<typename T>
6 struct InnerTemplate {
7 struct VeryInner {
8 typedef T type;
9
10 static enum K1 { K1Val = sizeof(T) } Kind1;
Douglas Gregor8dbc3c62009-05-27 17:20:35 +000011 static enum { K2Val = sizeof(T)*2 } Kind2;
Douglas Gregord0c87372009-05-27 17:30:49 +000012 enum { K3Val = sizeof(T)*2 } Kind3;
Douglas Gregor2bba76b2009-05-27 17:07:49 +000013
14 void foo() {
15 K1 k1 = K1Val;
16 Kind1 = K1Val;
17 Outer::Inner::InnerTemplate<type>::VeryInner::Kind2 = K2Val;
Douglas Gregord0c87372009-05-27 17:30:49 +000018 Kind3 = K3Val;
Douglas Gregor2bba76b2009-05-27 17:07:49 +000019 }
Douglas Gregord0c87372009-05-27 17:30:49 +000020
21 struct UeberInner {
22 void bar() {
23 K1 k1 = K1Val;
24 Kind1 = K1Val;
25 Outer::Inner::InnerTemplate<type>::VeryInner::Kind2 = K2Val;
Douglas Gregored961e72009-05-27 17:54:46 +000026
27 InnerTemplate t;
28 InnerTemplate<type> t2;
Douglas Gregord0c87372009-05-27 17:30:49 +000029 }
30 };
Douglas Gregor2bba76b2009-05-27 17:07:49 +000031 };
32 };
33 };
34 };
35}
36
37typedef int INT;
38template struct N::Outer::Inner::InnerTemplate<INT>::VeryInner;
Douglas Gregord0c87372009-05-27 17:30:49 +000039template struct N::Outer::Inner::InnerTemplate<INT>::UeberInner; // expected-error{{'UeberInner' does not name a tag member}}
Douglas Gregor6569d682009-05-27 23:11:45 +000040
41namespace N2 {
42 struct Outer2 {
43 template<typename T>
44 struct Inner {
45 void foo() {
46 enum { K1Val = sizeof(T) } k1;
47 enum K2 { K2Val = sizeof(T)*2 };
48
49 K2 k2 = K2Val;
50
51 Inner i1;
52 i1.foo();
53 Inner<T> i2;
54 i2.foo();
55 }
56 };
57 };
58}
59
60// FIXME: template struct N2::Outer2::Inner<float>;