add test for issue #1174
This commit is contained in:
parent
9fa44a41e6
commit
12a67af81d
16
src/test/run-pass/bind-native-printf.rs
Normal file
16
src/test/run-pass/bind-native-printf.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// From #1174:
|
||||
|
||||
use std;
|
||||
|
||||
#[link_name = ""]
|
||||
native mod libc {
|
||||
fn printf(s: *u8, a: int); /* A tenuous definition. */
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let b = std::str::bytes("%d\n");
|
||||
let b8 = unsafe { std::vec::unsafe::to_ptr(b) };
|
||||
libc::printf(b8, 4);
|
||||
let a = bind libc::printf(b8, 5);
|
||||
a(); /* core dump */
|
||||
}
|
Loading…
Reference in New Issue
Block a user