2019-12-02 01:38:33 +00:00
|
|
|
#![feature(c_variadic)]
|
2021-03-08 23:43:18 +00:00
|
|
|
#![allow(anonymous_parameters)]
|
2019-12-02 01:38:33 +00:00
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
2019-12-02 02:16:12 +00:00
|
|
|
fn f1_1(x: isize, ...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 01:38:33 +00:00
|
|
|
|
2019-12-02 02:16:12 +00:00
|
|
|
fn f1_2(...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
2019-12-02 01:38:33 +00:00
|
|
|
|
2019-12-02 02:16:12 +00:00
|
|
|
extern "C" fn f2_1(x: isize, ...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
|
|
|
|
extern "C" fn f2_2(...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
|
|
|
|
extern "C" fn f2_3(..., x: isize) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
|
2020-09-01 21:12:52 +00:00
|
|
|
extern "C" fn f3_1(x: isize, ...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
|
2020-09-01 21:12:52 +00:00
|
|
|
extern "C" fn f3_2(...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
|
2020-09-01 21:12:52 +00:00
|
|
|
extern "C" fn f3_3(..., x: isize) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
|
2020-09-01 21:12:52 +00:00
|
|
|
extern "C" {
|
2019-12-02 02:16:12 +00:00
|
|
|
fn e_f1(...);
|
|
|
|
//~^ ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
fn e_f2(..., x: isize);
|
2020-09-01 21:12:52 +00:00
|
|
|
//~^ ERROR `...` must be the last argument of a C-variadic function
|
2019-12-02 02:16:12 +00:00
|
|
|
}
|
2019-12-02 01:38:33 +00:00
|
|
|
|
|
|
|
struct X;
|
|
|
|
|
|
|
|
impl X {
|
2019-12-02 02:16:12 +00:00
|
|
|
fn i_f1(x: isize, ...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
fn i_f2(...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
fn i_f3(..., x: isize, ...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
|
|
|
//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
fn i_f4(..., x: isize, ...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
|
|
|
//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
2019-12-02 01:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trait T {
|
2019-12-02 02:16:12 +00:00
|
|
|
fn t_f1(x: isize, ...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
fn t_f2(x: isize, ...);
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
fn t_f3(...) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
fn t_f4(...);
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
fn t_f5(..., x: isize) {}
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
fn t_f6(..., x: isize);
|
2021-06-09 10:41:03 +00:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
2019-12-02 01:38:33 +00:00
|
|
|
}
|