Skip to content

Commit c509ef1

Browse files
frewsxcvemilio
authored andcommitted
Add failing regression test for #1973.
1 parent e0f06c7 commit c509ef1

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

bindgen-integration/cpp/Test.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,12 @@ Seventh::assert(bool first,
135135
int my_prefixed_function_name() {
136136
return 4;
137137
}
138+
139+
Coord coord(double x, double y, double z, double t) {
140+
Coord res;
141+
res.v[0] = x;
142+
res.v[1] = y;
143+
res.v[2] = z;
144+
res.v[3] = t;
145+
return res;
146+
}

bindgen-integration/cpp/Test.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,9 @@ struct my_prefixed_templated_foo {
226226
my_prefixed_templated_foo<my_prefixed_baz> TEMPLATED_CONST_VALUE;
227227

228228
void my_prefixed_function_to_remove();
229+
230+
typedef union {
231+
double v[4];
232+
} Coord;
233+
234+
Coord coord(double x, double y, double z, double t);

bindgen-integration/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,12 @@ fn test_macro_customintkind_path() {
259259
let v: &std::any::Any = &bindings::TESTMACRO_CUSTOMINTKIND_PATH;
260260
assert!(v.is::<MacroInteger>())
261261
}
262+
263+
// https://github.com/rust-lang/rust-bindgen/issues/1973
264+
#[test]
265+
fn test_homogeneous_aggregate_float_union() {
266+
unsafe {
267+
let coord = &bindings::coord(1., 2., 3., 4.);
268+
assert_eq!([1., 2., 3., 4.], coord.v)
269+
}
270+
}

0 commit comments

Comments
 (0)