aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/unsafe7.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/unsafe7.rs')
-rw-r--r--gcc/testsuite/rust/compile/unsafe7.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/unsafe7.rs b/gcc/testsuite/rust/compile/unsafe7.rs
new file mode 100644
index 0000000..a6b69e1
--- /dev/null
+++ b/gcc/testsuite/rust/compile/unsafe7.rs
@@ -0,0 +1,9 @@
+extern "C" {
+ fn printf(fmt: *const i8, ...);
+}
+
+fn main() {
+ let s = "hey\0";
+
+ printf(s as *const str as *const i8); // { dg-error "call to extern function" }
+}