Home | History | Annotate | Download | only in Index
      1 // Note: the run lines follow their respective tests, since line/column
      2 // matter in this test.
      3 
      4 template<class V>
      5 struct S {
      6   void operator()(int) const {}
      7   template<class T> void operator()(T) const {}
      8   template<class T> void operator()(V, T, T) const {}
      9   template<class T> const S<T> *operator()(const S<T> &s) const { return &s; }
     10 };
     11 
     12 void foo(S<void *> &s) { s(42); }
     13 
     14 int main() {
     15   S<void *> s;
     16   s(42);
     17   s(s);
     18   s(0, s, s);
     19   (*S<void *>()(S<int>()))(42, 42, 42);
     20 
     21   s(42,);
     22   s(s,);
     23   s(0, 42, 42,);
     24 }
     25 
     26 // RUN: c-index-test -code-completion-at=%s:16:5 %s | FileCheck -check-prefix=CHECK-CC1 %s
     27 // CHECK-CC1: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
     28 // CHECK-CC1: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
     29 // CHECK-CC1: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
     30 // CHECK-CC1: Completion contexts:
     31 // CHECK-CC1-NEXT: Any type
     32 // CHECK-CC1-NEXT: Any value
     33 // CHECK-CC1-NEXT: Enum tag
     34 // CHECK-CC1-NEXT: Union tag
     35 // CHECK-CC1-NEXT: Struct tag
     36 // CHECK-CC1-NEXT: Class name
     37 // CHECK-CC1-NEXT: Nested name specifier
     38 // CHECK-CC1-NEXT: Objective-C interface
     39 
     40 // RUN: c-index-test -code-completion-at=%s:17:5 %s | FileCheck -check-prefix=CHECK-CC2 %s
     41 // CHECK-CC2: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
     42 // CHECK-CC2: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
     43 // CHECK-CC2: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
     44 // CHECK-CC2: Completion contexts:
     45 // CHECK-CC2-NEXT: Any type
     46 // CHECK-CC2-NEXT: Any value
     47 // CHECK-CC2-NEXT: Enum tag
     48 // CHECK-CC2-NEXT: Union tag
     49 // CHECK-CC2-NEXT: Struct tag
     50 // CHECK-CC2-NEXT: Class name
     51 // CHECK-CC2-NEXT: Nested name specifier
     52 // CHECK-CC2-NEXT: Objective-C interface
     53 
     54 // RUN: c-index-test -code-completion-at=%s:18:5 %s | FileCheck -check-prefix=CHECK-CC3 %s
     55 // CHECK-CC3: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
     56 // CHECK-CC3: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
     57 // CHECK-CC3: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
     58 // CHECK-CC3: Completion contexts:
     59 // CHECK-CC3-NEXT: Any type
     60 // CHECK-CC3-NEXT: Any value
     61 // CHECK-CC3-NEXT: Enum tag
     62 // CHECK-CC3-NEXT: Union tag
     63 // CHECK-CC3-NEXT: Struct tag
     64 // CHECK-CC3-NEXT: Class name
     65 // CHECK-CC3-NEXT: Nested name specifier
     66 // CHECK-CC3-NEXT: Objective-C interface
     67 
     68 // RUN: c-index-test -code-completion-at=%s:18:7 %s | FileCheck -check-prefix=CHECK-CC4 %s
     69 // CHECK-CC4: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter T}{Comma , }{Placeholder T}{RightParen )} (1)
     70 // CHECK-CC4: Completion contexts:
     71 // CHECK-CC4-NEXT: Any type
     72 // CHECK-CC4-NEXT: Any value
     73 // CHECK-CC4-NEXT: Enum tag
     74 // CHECK-CC4-NEXT: Union tag
     75 // CHECK-CC4-NEXT: Struct tag
     76 // CHECK-CC4-NEXT: Class name
     77 // CHECK-CC4-NEXT: Nested name specifier
     78 // CHECK-CC4-NEXT: Objective-C interface
     79 
     80 // RUN: c-index-test -code-completion-at=%s:18:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
     81 // CHECK-CC5: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Placeholder void *}{Comma , }{Placeholder S<void *>}{Comma , }{CurrentParameter S<void *>}{RightParen )} (1)
     82 // CHECK-CC5: Completion contexts:
     83 // CHECK-CC5-NEXT: Any type
     84 // CHECK-CC5-NEXT: Any value
     85 // CHECK-CC5-NEXT: Enum tag
     86 // CHECK-CC5-NEXT: Union tag
     87 // CHECK-CC5-NEXT: Struct tag
     88 // CHECK-CC5-NEXT: Class name
     89 // CHECK-CC5-NEXT: Nested name specifier
     90 // CHECK-CC5-NEXT: Objective-C interface
     91 
     92 // RUN: c-index-test -code-completion-at=%s:19:17 %s | FileCheck -check-prefix=CHECK-CC6 %s
     93 // CHECK-CC6: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
     94 // CHECK-CC6: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
     95 // CHECK-CC6: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
     96 // CHECK-CC6: OverloadCandidate:{ResultType const S<T> *}{Text operator()}{LeftParen (}{CurrentParameter const S<T> &s}{RightParen )} (1)
     97 // CHECK-CC6: Completion contexts:
     98 // CHECK-CC6-NEXT: Any type
     99 // CHECK-CC6-NEXT: Any value
    100 // CHECK-CC6-NEXT: Enum tag
    101 // CHECK-CC6-NEXT: Union tag
    102 // CHECK-CC6-NEXT: Struct tag
    103 // CHECK-CC6-NEXT: Class name
    104 // CHECK-CC6-NEXT: Nested name specifier
    105 // CHECK-CC6-NEXT: Objective-C interface
    106 
    107 // RUN: c-index-test -code-completion-at=%s:19:28 %s | FileCheck -check-prefix=CHECK-CC7 %s
    108 // CHECK-CC7: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
    109 // CHECK-CC7: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
    110 // CHECK-CC7: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
    111 // CHECK-CC7: OverloadCandidate:{ResultType const S<T> *}{Text operator()}{LeftParen (}{CurrentParameter const S<T> &s}{RightParen )} (1)
    112 // CHECK-CC7: Completion contexts:
    113 // CHECK-CC7-NEXT: Any type
    114 // CHECK-CC7-NEXT: Any value
    115 // CHECK-CC7-NEXT: Enum tag
    116 // CHECK-CC7-NEXT: Union tag
    117 // CHECK-CC7-NEXT: Struct tag
    118 // CHECK-CC7-NEXT: Class name
    119 // CHECK-CC7-NEXT: Nested name specifier
    120 // CHECK-CC7-NEXT: Objective-C interface
    121 
    122 // RUN: c-index-test -code-completion-at=%s:19:31 %s | FileCheck -check-prefix=CHECK-CC8 %s
    123 // CHECK-CC8: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter T}{Comma , }{Placeholder T}{RightParen )} (1)
    124 // CHECK-CC8: Completion contexts:
    125 // CHECK-CC8-NEXT: Any type
    126 // CHECK-CC8-NEXT: Any value
    127 // CHECK-CC8-NEXT: Enum tag
    128 // CHECK-CC8-NEXT: Union tag
    129 // CHECK-CC8-NEXT: Struct tag
    130 // CHECK-CC8-NEXT: Class name
    131 // CHECK-CC8-NEXT: Nested name specifier
    132 // CHECK-CC8-NEXT: Objective-C interface
    133 
    134 // RUN: c-index-test -code-completion-at=%s:19:35 %s | FileCheck -check-prefix=CHECK-CC9 %s
    135 // CHECK-CC9: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
    136 // CHECK-CC9: Completion contexts:
    137 // CHECK-CC9-NEXT: Any type
    138 // CHECK-CC9-NEXT: Any value
    139 // CHECK-CC9-NEXT: Enum tag
    140 // CHECK-CC9-NEXT: Union tag
    141 // CHECK-CC9-NEXT: Struct tag
    142 // CHECK-CC9-NEXT: Class name
    143 // CHECK-CC9-NEXT: Nested name specifier
    144 // CHECK-CC9-NEXT: Objective-C interface
    145 
    146 // RUN: c-index-test -code-completion-at=%s:21:8 %s | FileCheck -check-prefix=CHECK-CC10 %s
    147 // CHECK-CC10: Completion contexts:
    148 // CHECK-CC10-NEXT: Any type
    149 // CHECK-CC10-NEXT: Any value
    150 // CHECK-CC10-NEXT: Enum tag
    151 // CHECK-CC10-NEXT: Union tag
    152 // CHECK-CC10-NEXT: Struct tag
    153 // CHECK-CC10-NEXT: Class name
    154 // CHECK-CC10-NEXT: Nested name specifier
    155 // CHECK-CC10-NEXT: Objective-C interface
    156 
    157 // RUN: c-index-test -code-completion-at=%s:22:7 %s | FileCheck -check-prefix=CHECK-CC11 %s
    158 // CHECK-CC11: Completion contexts:
    159 // CHECK-CC11-NEXT: Any type
    160 // CHECK-CC11-NEXT: Any value
    161 // CHECK-CC11-NEXT: Enum tag
    162 // CHECK-CC11-NEXT: Union tag
    163 // CHECK-CC11-NEXT: Struct tag
    164 // CHECK-CC11-NEXT: Class name
    165 // CHECK-CC11-NEXT: Nested name specifier
    166 // CHECK-CC11-NEXT: Objective-C interface
    167 
    168 // RUN: c-index-test -code-completion-at=%s:23:15 %s | FileCheck -check-prefix=CHECK-CC12 %s
    169 // CHECK-CC12: Completion contexts:
    170 // CHECK-CC12-NEXT: Any type
    171 // CHECK-CC12-NEXT: Any value
    172 // CHECK-CC12-NEXT: Enum tag
    173 // CHECK-CC12-NEXT: Union tag
    174 // CHECK-CC12-NEXT: Struct tag
    175 // CHECK-CC12-NEXT: Class name
    176 // CHECK-CC12-NEXT: Nested name specifier
    177 // CHECK-CC12-NEXT: Objective-C interface
    178 
    179 // RUN: c-index-test -code-completion-at=%s:12:28 %s | FileCheck -check-prefix=CHECK-CC13 %s
    180 // CHECK-CC13: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
    181 // CHECK-CC13: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
    182 // CHECK-CC13: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
    183 // CHECK-CC13: Completion contexts:
    184 // CHECK-CC13-NEXT: Any type
    185 // CHECK-CC13-NEXT: Any value
    186 // CHECK-CC13-NEXT: Enum tag
    187 // CHECK-CC13-NEXT: Union tag
    188 // CHECK-CC13-NEXT: Struct tag
    189 // CHECK-CC13-NEXT: Class name
    190 // CHECK-CC13-NEXT: Nested name specifier
    191 // CHECK-CC13-NEXT: Objective-C interface
    192