]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0617.rs
Merge commit '266e96785ab71834b917bf474f130a6d8fdecd4b' into sync_cg_clif-2022-10-23
[rust.git] / src / test / ui / error-codes / E0617.rs
1 extern "C" {
2     fn printf(c: *const i8, ...);
3 }
4
5 fn main() {
6     unsafe {
7         printf(::std::ptr::null(), 0f32);
8         //~^ ERROR can't pass `f32` to variadic function
9         //~| HELP cast the value to `c_double`
10         printf(::std::ptr::null(), 0i8);
11         //~^ ERROR can't pass `i8` to variadic function
12         //~| HELP cast the value to `c_int`
13         printf(::std::ptr::null(), 0i16);
14         //~^ ERROR can't pass `i16` to variadic function
15         //~| HELP cast the value to `c_int`
16         printf(::std::ptr::null(), 0u8);
17         //~^ ERROR can't pass `u8` to variadic function
18         //~| HELP cast the value to `c_uint`
19         printf(::std::ptr::null(), 0u16);
20         //~^ ERROR can't pass `u16` to variadic function
21         //~| HELP cast the value to `c_uint`
22         printf(::std::ptr::null(), printf);
23         //~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
24         //~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)`
25     }
26 }