xref: /llvm-project/clang/test/CodeCompletion/variadic-template.cpp (revision aa7497a66c4272669fa63f7ec61a3f01aa9dabaf)
1 template <typename T, typename... Args>
2 void fun(T x, Args... args) {}
3 
4 void f() {
5   fun(1, 2, 3, 4);
6   // The results are quite awkward here, but it's the best we can do for now.
7   // Tools, including clangd, can unexpand "args" when showing this to the user.
8   // The important thing is that we provide OVERLOAD signature in all those cases.
9   //
10   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-5):7 %s -o - | FileCheck --check-prefix=CHECK-1 %s
11   // CHECK-1: OVERLOAD: [#void#]fun(<#T x#>)
12   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-7):10 %s -o - | FileCheck --check-prefix=CHECK-2 %s
13   // CHECK-2: OVERLOAD: [#void#]fun(int x)
14   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-9):13 %s -o - | FileCheck --check-prefix=CHECK-3 %s
15   // CHECK-3: OVERLOAD: [#void#]fun(int x, int args)
16   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-11):16 %s -o - | FileCheck --check-prefix=CHECK-4 %s
17   // CHECK-4: OVERLOAD: [#void#]fun(int x, int args, int args)
18 }
19