1*f4a2713aSLionel Sambuc template<typename ...Args> 2*f4a2713aSLionel Sambuc int f(Args ...args) { 3*f4a2713aSLionel Sambuc return sizeof...(args) + sizeof...(Args); 4*f4a2713aSLionel Sambuc } 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc void test() { 7*f4a2713aSLionel Sambuc int a; 8*f4a2713aSLionel Sambuc decltype(a) b; 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc typedef int Integer; 11*f4a2713aSLionel Sambuc typedef float Float; 12*f4a2713aSLionel Sambuc typedef bool Bool; 13*f4a2713aSLionel Sambuc bool b2 = __is_trivially_constructible(Integer, Float, Bool); 14*f4a2713aSLionel Sambuc } 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc typedef int Int; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc class B { 19*f4a2713aSLionel Sambuc virtual void foo(Int); 20*f4a2713aSLionel Sambuc }; 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc class S : public B { 23*f4a2713aSLionel Sambuc virtual void foo(Int) override; 24*f4a2713aSLionel Sambuc }; 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc // Need std::initializer_list 27*f4a2713aSLionel Sambuc namespace std { 28*f4a2713aSLionel Sambuc typedef decltype(sizeof(int)) size_t; 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc // libc++'s implementation 31*f4a2713aSLionel Sambuc template <class _E> 32*f4a2713aSLionel Sambuc class initializer_list 33*f4a2713aSLionel Sambuc { 34*f4a2713aSLionel Sambuc const _E* __begin_; 35*f4a2713aSLionel Sambuc size_t __size_; 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc initializer_list(const _E* __b, size_t __s) 38*f4a2713aSLionel Sambuc : __begin_(__b), 39*f4a2713aSLionel Sambuc __size_(__s) 40*f4a2713aSLionel Sambuc {} 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc public: 43*f4a2713aSLionel Sambuc typedef _E value_type; 44*f4a2713aSLionel Sambuc typedef const _E& reference; 45*f4a2713aSLionel Sambuc typedef const _E& const_reference; 46*f4a2713aSLionel Sambuc typedef size_t size_type; 47*f4a2713aSLionel Sambuc 48*f4a2713aSLionel Sambuc typedef const _E* iterator; 49*f4a2713aSLionel Sambuc typedef const _E* const_iterator; 50*f4a2713aSLionel Sambuc 51*f4a2713aSLionel Sambuc initializer_list() : __begin_(nullptr), __size_(0) {} 52*f4a2713aSLionel Sambuc 53*f4a2713aSLionel Sambuc size_t size() const {return __size_;} 54*f4a2713aSLionel Sambuc const _E* begin() const {return __begin_;} 55*f4a2713aSLionel Sambuc const _E* end() const {return __begin_ + __size_;} 56*f4a2713aSLionel Sambuc }; 57*f4a2713aSLionel Sambuc } 58*f4a2713aSLionel Sambuc 59*f4a2713aSLionel Sambuc struct Foo { 60*f4a2713aSLionel Sambuc Foo(std::initializer_list<int> il); 61*f4a2713aSLionel Sambuc }; 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc void test2() { 64*f4a2713aSLionel Sambuc Foo{10}; 65*f4a2713aSLionel Sambuc } 66*f4a2713aSLionel Sambuc 67*f4a2713aSLionel Sambuc 68*f4a2713aSLionel Sambuc // RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 -fno-delayed-template-parsing -std=c++11 %s | FileCheck %s 69*f4a2713aSLionel Sambuc // CHECK: Identifier: "args" [3:20 - 3:24] SizeOfPackExpr=args:2:15 70*f4a2713aSLionel Sambuc // CHECK: Identifier: "Args" [3:38 - 3:42] TypeRef=Args:1:22 71*f4a2713aSLionel Sambuc 72*f4a2713aSLionel Sambuc // RUN: c-index-test -test-annotate-tokens=%s:8:1:9:1 -std=c++11 %s | FileCheck -check-prefix=CHECK-DECLTYPE %s 73*f4a2713aSLionel Sambuc // CHECK-DECLTYPE: Identifier: "a" [8:12 - 8:13] DeclRefExpr=a:7:7 74*f4a2713aSLionel Sambuc 75*f4a2713aSLionel Sambuc // RUN: c-index-test -test-annotate-tokens=%s:13:1:14:1 -std=c++11 %s | FileCheck -check-prefix=CHECK-TRAIT %s 76*f4a2713aSLionel Sambuc // CHECK-TRAIT: Identifier: "Integer" [13:42 - 13:49] TypeRef=Integer:10:15 77*f4a2713aSLionel Sambuc // CHECK-TRAIT: Identifier: "Float" [13:51 - 13:56] TypeRef=Float:11:17 78*f4a2713aSLionel Sambuc // CHECK-TRAIT: Identifier: "Bool" [13:58 - 13:62] TypeRef=Bool:12:16 79*f4a2713aSLionel Sambuc 80*f4a2713aSLionel Sambuc // RUN: c-index-test -test-annotate-tokens=%s:16:1:24:1 -std=c++11 %s | FileCheck -check-prefix=CHECK-WITH-OVERRIDE %s 81*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Keyword: "virtual" [19:2 - 19:9] CXXMethod=foo:19:15 (virtual) 82*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Keyword: "void" [19:10 - 19:14] CXXMethod=foo:19:15 (virtual) 83*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Identifier: "foo" [19:15 - 19:18] CXXMethod=foo:19:15 (virtual) 84*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Punctuation: "(" [19:18 - 19:19] CXXMethod=foo:19:15 (virtual) 85*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Identifier: "Int" [19:19 - 19:22] TypeRef=Int:16:13 86*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Punctuation: ")" [19:22 - 19:23] ParmDecl=:19:22 (Definition) 87*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Punctuation: ";" [19:23 - 19:24] ClassDecl=B:18:7 (Definition) 88*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Keyword: "virtual" [23:3 - 23:10] CXXMethod=foo:23:16 (virtual) [Overrides @19:15] 89*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Keyword: "void" [23:11 - 23:15] CXXMethod=foo:23:16 (virtual) [Overrides @19:15] 90*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Identifier: "foo" [23:16 - 23:19] CXXMethod=foo:23:16 (virtual) [Overrides @19:15] 91*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Punctuation: "(" [23:19 - 23:20] CXXMethod=foo:23:16 (virtual) [Overrides @19:15] 92*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Identifier: "Int" [23:20 - 23:23] TypeRef=Int:16:13 93*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Punctuation: ")" [23:23 - 23:24] ParmDecl=:23:23 (Definition) 94*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Keyword: "override" [23:25 - 23:33] attribute(override)= 95*f4a2713aSLionel Sambuc // CHECK-WITH-OVERRIDE: Punctuation: ";" [23:33 - 23:34] ClassDecl=S:22:7 (Definition) 96*f4a2713aSLionel Sambuc 97*f4a2713aSLionel Sambuc // RUN: c-index-test -test-annotate-tokens=%s:64:1:65:1 -std=c++11 %s | FileCheck -check-prefix=CHECK-INITLIST %s 98*f4a2713aSLionel Sambuc // CHECK-INITLIST: Identifier: "Foo" [64:3 - 64:6] TypeRef=struct Foo:59:8 99