From 9a52ca27f2283854e5295d0e94e2fcf97c941211 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 5 Apr 2017 16:56:49 -0700 Subject: Add a test explicitly for default type parameters This is exercised in other tests, but in a round about fashion. It is nice to have a test that explicitly exercises default type parameters, without any cruft. --- .../tests/default-template-parameter.rs | 30 ++++++++++++++++++++++ tests/headers/default-template-parameter.hpp | 7 +++++ 2 files changed, 37 insertions(+) create mode 100644 tests/expectations/tests/default-template-parameter.rs create mode 100644 tests/headers/default-template-parameter.hpp diff --git a/tests/expectations/tests/default-template-parameter.rs b/tests/expectations/tests/default-template-parameter.rs new file mode 100644 index 00000000..af4616ff --- /dev/null +++ b/tests/expectations/tests/default-template-parameter.rs @@ -0,0 +1,30 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct Foo { + pub t: T, + pub u: U, +} +impl Default for Foo { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +#[test] +fn __bindgen_test_layout_Foo_instantiation_6() { + assert_eq!(::std::mem::size_of::>() , + 8usize , concat ! ( + "Size of template specialization: " , stringify ! ( + Foo ) )); + assert_eq!(::std::mem::align_of::>() , + 4usize , concat ! ( + "Alignment of template specialization: " , stringify ! ( + Foo ) )); +} +extern "C" { + #[link_name = "_ZL3bar"] + pub static mut bar: Foo; +} diff --git a/tests/headers/default-template-parameter.hpp b/tests/headers/default-template-parameter.hpp new file mode 100644 index 00000000..4deed834 --- /dev/null +++ b/tests/headers/default-template-parameter.hpp @@ -0,0 +1,7 @@ +template +struct Foo { + T t; + U u; +}; + +static Foo bar; -- cgit v1.2.3