Douglas Gregor | dc35571 | 2011-02-25 00:36:19 +0000 | [diff] [blame] | 1 | namespace outer { |
| 2 | namespace inner { |
| 3 | template<typename T> |
| 4 | struct vector { |
| 5 | typedef T* iterator; |
| 6 | }; |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | namespace outer_alias = outer; |
| 11 | |
| 12 | struct X { }; |
| 13 | |
| 14 | using outer_alias::inner::vector; |
| 15 | |
| 16 | struct X_vector : outer_alias::inner::vector<X> { |
| 17 | using outer_alias::inner::vector<X>::iterator; |
| 18 | }; |
| 19 | |
Douglas Gregor | c22b5ff | 2011-02-25 02:25:35 +0000 | [diff] [blame^] | 20 | namespace 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 Gregor | dc35571 | 2011-02-25 00:36:19 +0000 | [diff] [blame] | 29 | |
Douglas Gregor | c22b5ff | 2011-02-25 02:25:35 +0000 | [diff] [blame^] | 30 | template<typename T, unsigned N> |
| 31 | void outer::inner::array<T, N>::foo() { |
| 32 | } |
Douglas Gregor | dc35571 | 2011-02-25 00:36:19 +0000 | [diff] [blame] | 33 | |
Douglas Gregor | c22b5ff | 2011-02-25 02:25:35 +0000 | [diff] [blame^] | 34 | template<typename T, unsigned N> |
| 35 | int 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 Gregor | dc35571 | 2011-02-25 00:36:19 +0000 | [diff] [blame] | 38 | |
| 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 Gregor | c22b5ff | 2011-02-25 02:25:35 +0000 | [diff] [blame^] | 58 | |
| 59 | // FIXME: Check nested-name-specifiers on VarDecl, CXXMethodDecl. |