1// RUN: %check_clang_tidy %s cert-dcl50-cpp %t
2
3// Variadic function definitions are diagnosed.
4void f1(int, ...) {}
5// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: do not define a C-style variadic function; consider using a function parameter pack or currying instead [cert-dcl50-cpp]
6
7// Variadic function *declarations* are not diagnosed.
8void f2(int, ...); // ok
9
10// Function parameter packs are good, however.
11template <typename Arg, typename... Ts>
12void f3(Arg F, Ts... Rest) {}
13
14struct S {
15 void f(int, ...); // ok
16 void f1(int, ...) {}
17 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: do not define a C-style variadic function; consider using a function parameter pack or currying instead
18};
19
20// Function definitions that are extern "C" are good.
21extern "C" void f4(int, ...) {} // ok
22extern "C" {
23 void f5(int, ...) {} // ok
24}
25

source code of clang-tools-extra/test/clang-tidy/checkers/cert/variadic-function-def.cpp