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, ...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 01:38:33 +00:00
|
|
|
|
2019-12-02 02:16:12 +00:00
|
|
|
fn f1_2(...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 01:38:33 +00:00
|
|
|
|
2019-12-02 02:16:12 +00:00
|
|
|
extern "C" fn f2_1(x: isize, ...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
|
|
|
|
extern "C" fn f2_2(...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
|
|
|
|
extern "C" fn f2_3(..., x: isize) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
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, ...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
|
2020-09-01 21:12:52 +00:00
|
|
|
extern "C" fn f3_2(...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
|
2020-09-01 21:12:52 +00:00
|
|
|
extern "C" fn f3_3(..., x: isize) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
|
2023-10-29 21:28:56 +00:00
|
|
|
const unsafe extern "C" fn f4_1(x: isize, ...) {}
|
|
|
|
//~^ ERROR functions cannot be both `const` and C-variadic
|
2024-02-01 22:45:00 +00:00
|
|
|
//~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time
|
2023-10-29 21:28:56 +00:00
|
|
|
|
|
|
|
const extern "C" fn f4_2(x: isize, ...) {}
|
|
|
|
//~^ ERROR functions cannot be both `const` and C-variadic
|
2024-06-23 06:19:19 +00:00
|
|
|
//~| ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2024-02-01 22:45:00 +00:00
|
|
|
//~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time
|
2023-10-29 21:28:56 +00:00
|
|
|
|
|
|
|
const extern "C" fn f4_3(..., x: isize, ...) {}
|
|
|
|
//~^ ERROR functions cannot be both `const` and C-variadic
|
2024-06-23 06:19:19 +00:00
|
|
|
//~| ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2023-10-29 21:28:56 +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_f2(..., x: isize);
|
2024-02-01 22:45:00 +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, ...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
fn i_f2(...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
fn i_f3(..., x: isize, ...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
fn i_f4(..., x: isize, ...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
2023-10-29 21:28:56 +00:00
|
|
|
const fn i_f5(x: isize, ...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2023-10-29 21:28:56 +00:00
|
|
|
//~| ERROR functions cannot be both `const` and C-variadic
|
2024-02-01 22:45:00 +00:00
|
|
|
//~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time
|
2019-12-02 01:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trait T {
|
2019-12-02 02:16:12 +00:00
|
|
|
fn t_f1(x: isize, ...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
fn t_f2(x: isize, ...);
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
fn t_f3(...) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
fn t_f4(...);
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
fn t_f5(..., x: isize) {}
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
2019-12-02 02:16:12 +00:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
fn t_f6(..., x: isize);
|
2024-06-23 06:19:19 +00:00
|
|
|
//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
|
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
|
|
|
}
|