about summary refs log tree commit diff
path: root/tests/ui/foreign/foreign-truncated-arguments.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/foreign/foreign-truncated-arguments.rs')
-rw-r--r--tests/ui/foreign/foreign-truncated-arguments.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/foreign/foreign-truncated-arguments.rs b/tests/ui/foreign/foreign-truncated-arguments.rs
new file mode 100644
index 00000000000..c61c2b587b6
--- /dev/null
+++ b/tests/ui/foreign/foreign-truncated-arguments.rs
@@ -0,0 +1,20 @@
+// run-pass
+// compile-flags: -O
+// Regression test for https://github.com/rust-lang/rust/issues/33868
+
+#[repr(C)]
+pub struct S {
+    a: u32,
+    b: f32,
+    c: u32
+}
+
+#[no_mangle]
+#[inline(never)]
+pub extern "C" fn test(s: S) -> u32 {
+    s.c
+}
+
+fn main() {
+    assert_eq!(test(S{a: 0, b: 0.0, c: 42}), 42);
+}