Skip to content

Commit 95721d3

Browse files
committed
Add test case for #28676.
1 parent 039f0f4 commit 95721d3

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/rt/rust_test_helpers.c

+4
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,7 @@ uint64_t get_y(struct S s) {
218218
uint64_t get_z(struct S s) {
219219
return s.z;
220220
}
221+
222+
uint64_t get_c_many_params(void *a, void *b, void *c, void *d, struct quad f) {
223+
return f.c;
224+
}

src/test/run-pass/issue-28676.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
//
11+
12+
#[derive(Copy, Clone)]
13+
pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
14+
15+
mod rustrt {
16+
use super::Quad;
17+
18+
#[link(name = "rust_test_helpers")]
19+
extern {
20+
pub fn get_c_many_params(_: *const (), _: *const (),
21+
_: *const (), _: *const (), f: Quad) -> u64;
22+
}
23+
}
24+
25+
fn test() {
26+
unsafe {
27+
let null = std::ptr::null();
28+
let q = Quad {
29+
a: 1,
30+
b: 2,
31+
c: 3,
32+
d: 4
33+
};
34+
assert_eq!(rustrt::get_c_many_params(null, null, null, null, q), q.c);
35+
}
36+
}
37+
38+
pub fn main() {
39+
test();
40+
}

0 commit comments

Comments
 (0)