Debian Codegraph @

clang/test/Parser/cxx2c-oxford-variadic-comma.cpp

raw
1 // RUN: %clang_cc1 -std=c++2c -fsyntax-only -fblocks -verify %s
2
3 void a(...);
4
5 void b(auto...);
6 void c(auto, ...);
7
8 void d(auto......); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}} \
9 // expected-warning {{'...' in this location creates a C-style varargs function}} \
10 // expected-note {{preceding '...' declares a function parameter pack}} \
11 // expected-note {{insert ',' before '...' to silence this warning}}
12 void e(auto..., ...);
13
14 void f(auto x...); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}
15 void g(auto x, ...);
16
17 void h(auto... x...); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}} \
18 // expected-warning {{'...' in this location creates a C-style varargs function}} \
19 // expected-note {{preceding '...' declares a function parameter pack}} \
20 // expected-note {{insert ',' before '...' to silence this warning}}
21 void i(auto... x, ...);
22
23 template<class ...Ts>
24 void j(Ts... t...) {}; // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}} \
25 // expected-warning {{'...' in this location creates a C-style varargs function}} \
26 // expected-note {{preceding '...' declares a function parameter pack}} \
27 // expected-note {{insert ',' before '...' to silence this warning}}
28 template<class ...Ts>
29 void k(Ts... t, ...) {}
30
31 void l(int...); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}
32 void m(int, ...);
33
34 void n(int x...); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}
35 void o(int x, ...);
36
37 struct S {
38 void p(this S...) {} // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}
39 void f(int = {}...); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}
40 };
41
42 template<class ...Ts>
43 void q(Ts......) {} // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}} \
44 // expected-warning {{'...' in this location creates a C-style varargs function}} \
45 // expected-note {{preceding '...' declares a function parameter pack}} \
46 // expected-note {{insert ',' before '...' to silence this warning}}
47
48 template<class T>
49 void r(T...) {} // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}
50
51 auto type_specifier = (void (*)(int...)) nullptr; // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}
52
53 auto lambda = [](int...) {}; // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}
54
55 auto block = ^(int...){}; // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}