Skip to content

Commit

Permalink
Add failing regression test for rust-lang#1973.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Jan 30, 2021
1 parent e0f06c7 commit 60b699f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bindgen-integration/cpp/Test.cc
Expand Up @@ -135,3 +135,12 @@ Seventh::assert(bool first,
int my_prefixed_function_name() {
return 4;
}

Coord coord(double x, double y, double z, double t) {
Coord res;
res.v[0] = x;
res.v[1] = y;
res.v[2] = z;
res.v[3] = t;
return res;
}
6 changes: 6 additions & 0 deletions bindgen-integration/cpp/Test.h
Expand Up @@ -226,3 +226,9 @@ struct my_prefixed_templated_foo {
my_prefixed_templated_foo<my_prefixed_baz> TEMPLATED_CONST_VALUE;

void my_prefixed_function_to_remove();

typedef union {
double v[4];
} Coord;

Coord coord(double x, double y, double z, double t);
9 changes: 9 additions & 0 deletions bindgen-integration/src/lib.rs
Expand Up @@ -259,3 +259,12 @@ fn test_macro_customintkind_path() {
let v: &std::any::Any = &bindings::TESTMACRO_CUSTOMINTKIND_PATH;
assert!(v.is::<MacroInteger>())
}

// https://github.com/rust-lang/rust-bindgen/issues/1973
#[test]
fn test_homogeneous_aggregate_float_union() {
unsafe {
let coord = &bindings::coord(1., 2., 3., 4.);
assert_eq!([1., 2., 3., 4.], coord.v)
}
}

0 comments on commit 60b699f

Please sign in to comment.