summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-04-05 19:26:03 -0500
committerGitHub <noreply@github.com>2017-04-05 19:26:03 -0500
commit261a81c7940dbde0f09f19cc4dd10437f8d230e8 (patch)
tree98562ad926eee558d726981a17e2d2b2d8acf315
parentabd454cfc67c6815bc9084fdf5b1405bfd5ac660 (diff)
parent9a52ca27f2283854e5295d0e94e2fcf97c941211 (diff)
Auto merge of #616 - fitzgen:explicit-test-for-default-type-parameters, r=emilio
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. r? @emilio
-rw-r--r--tests/expectations/tests/default-template-parameter.rs30
-rw-r--r--tests/headers/default-template-parameter.hpp7
2 files changed, 37 insertions, 0 deletions
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<T, U> {
+ pub t: T,
+ pub u: U,
+}
+impl <T, U> Default for Foo<T, U> {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+#[test]
+fn __bindgen_test_layout_Foo_instantiation_6() {
+ assert_eq!(::std::mem::size_of::<Foo<bool, ::std::os::raw::c_int>>() ,
+ 8usize , concat ! (
+ "Size of template specialization: " , stringify ! (
+ Foo<bool, ::std::os::raw::c_int> ) ));
+ assert_eq!(::std::mem::align_of::<Foo<bool, ::std::os::raw::c_int>>() ,
+ 4usize , concat ! (
+ "Alignment of template specialization: " , stringify ! (
+ Foo<bool, ::std::os::raw::c_int> ) ));
+}
+extern "C" {
+ #[link_name = "_ZL3bar"]
+ pub static mut bar: Foo<bool, ::std::os::raw::c_int>;
+}
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 <typename T, typename U = int>
+struct Foo {
+ T t;
+ U u;
+};
+
+static Foo<bool> bar;