56 lines · cpp
1// RUN: %clang_cc1 -std=c++2c -fsyntax-only -fblocks -verify %s2 3void a(...);4 5void b(auto...);6void c(auto, ...);7 8void 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}}12void e(auto..., ...);13 14void f(auto x...); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}15void g(auto x, ...);16 17void 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}}21void i(auto... x, ...);22 23template<class ...Ts>24void 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}}28template<class ...Ts>29void k(Ts... t, ...) {}30 31void l(int...); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}32void m(int, ...);33 34void n(int x...); // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}35void o(int x, ...);36 37struct 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 42template<class ...Ts>43void 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 48template<class T>49void r(T...) {} // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}50 51auto type_specifier = (void (*)(int...)) nullptr; // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}52 53auto lambda = [](int...) {}; // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}54 55auto block = ^(int...){}; // expected-warning {{declaration of a variadic function without a comma before '...' is deprecated}}56