blob: 6b2c9c4664af4d130a05f2c6c41481ec941565c7 [file] [log] [blame]
Douglas Gregordc355712011-02-25 00:36:19 +00001namespace outer {
2 namespace inner {
3 template<typename T>
4 struct vector {
5 typedef T* iterator;
6 };
7 }
8}
9
10namespace outer_alias = outer;
11
12struct X { };
13
14using outer_alias::inner::vector;
15
16struct X_vector : outer_alias::inner::vector<X> {
17 using outer_alias::inner::vector<X>::iterator;
18};
19
Douglas Gregorc22b5ff2011-02-25 02:25:35 +000020namespace outer {
21 namespace inner {
22 template<typename T, unsigned N>
23 struct array {
24 void foo();
25 static int max_size;
26 };
27 }
28}
Douglas Gregordc355712011-02-25 00:36:19 +000029
Douglas Gregorc22b5ff2011-02-25 02:25:35 +000030template<typename T, unsigned N>
31void outer::inner::array<T, N>::foo() {
32}
Douglas Gregordc355712011-02-25 00:36:19 +000033
Douglas Gregorc22b5ff2011-02-25 02:25:35 +000034template<typename T, unsigned N>
35int outer::inner::array<T, N>::max_size = 17;
36
37// RUN: c-index-test -test-annotate-tokens=%s:13:1:36:1 %s | FileCheck %s
Douglas Gregordc355712011-02-25 00:36:19 +000038
39// CHECK: Keyword: "using" [14:1 - 14:6] UsingDeclaration=vector[4:12]
40// CHECK: Identifier: "outer_alias" [14:7 - 14:18] NamespaceRef=outer_alias:10:11
41// CHECK: Punctuation: "::" [14:18 - 14:20] UsingDeclaration=vector[4:12]
42// CHECK: Identifier: "inner" [14:20 - 14:25] NamespaceRef=inner:2:13
43// CHECK: Punctuation: "::" [14:25 - 14:27] UsingDeclaration=vector[4:12]
44// CHECK: Identifier: "vector" [14:27 - 14:33] OverloadedDeclRef=vector[4:12]
45// CHECK: Punctuation: ";" [14:33 - 14:34]
46// FIXME: Base specifiers, too
47// CHECK: Keyword: "using" [17:3 - 17:8] UsingDeclaration=iterator[5:18]
48// CHECK: Identifier: "outer_alias" [17:9 - 17:20] NamespaceRef=outer_alias:10:11
49// CHECK: Punctuation: "::" [17:20 - 17:22] UsingDeclaration=iterator[5:18]
50// CHECK: Identifier: "inner" [17:22 - 17:27] NamespaceRef=inner:2:13
51// CHECK: Punctuation: "::" [17:27 - 17:29] UsingDeclaration=iterator[5:18]
52// CHECK: Identifier: "vector" [17:29 - 17:35] TemplateRef=vector:4:12
53// CHECK: Punctuation: "<" [17:35 - 17:36] UsingDeclaration=iterator[5:18]
54// CHECK: Identifier: "X" [17:36 - 17:37] TypeRef=struct X:12:8
55// CHECK: Punctuation: ">" [17:37 - 17:38] UsingDeclaration=iterator[5:18]
56// CHECK: Punctuation: "::" [17:38 - 17:40] UsingDeclaration=iterator[5:18]
57// CHECK: Identifier: "iterator" [17:40 - 17:48] OverloadedDeclRef=iterator[5:18]
Douglas Gregorc22b5ff2011-02-25 02:25:35 +000058
59// FIXME: Check nested-name-specifiers on VarDecl, CXXMethodDecl.