summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/tests/anonymous-template-types.rs33
-rw-r--r--tests/expectations/tests/bad-namespace-parenthood-inheritance.rs10
-rw-r--r--tests/expectations/tests/issue-358.rs5
-rw-r--r--tests/expectations/tests/issue-544-stylo-creduce.rs5
-rw-r--r--tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs2
-rw-r--r--tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs38
-rw-r--r--tests/headers/anonymous-template-types.hpp24
-rw-r--r--tests/headers/issue-574-assertion-failure-in-codegen.hpp6
8 files changed, 109 insertions, 14 deletions
diff --git a/tests/expectations/tests/anonymous-template-types.rs b/tests/expectations/tests/anonymous-template-types.rs
new file mode 100644
index 00000000..bb4be105
--- /dev/null
+++ b/tests/expectations/tests/anonymous-template-types.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Foo<T> {
+ pub t_member: T,
+}
+impl <T> Default for Foo<T> {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct Bar {
+ pub member: ::std::os::raw::c_schar,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Quux<V> {
+ pub v_member: V,
+}
+impl <V> Default for Quux<V> {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct Lobo {
+ pub also_member: ::std::os::raw::c_schar,
+}
+pub type AliasWithAnonType = ::std::os::raw::c_schar;
diff --git a/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs b/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs
index 4074dd02..9ff4af1f 100644
--- a/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs
+++ b/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs
@@ -5,15 +5,15 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct std_char_traits {
pub _address: u8,
}
+impl Default for std_char_traits {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct __gnu_cxx_char_traits {
pub _address: u8,
}
-impl Clone for __gnu_cxx_char_traits {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/issue-358.rs b/tests/expectations/tests/issue-358.rs
index e574bd01..d01ae800 100644
--- a/tests/expectations/tests/issue-358.rs
+++ b/tests/expectations/tests/issue-358.rs
@@ -13,13 +13,10 @@ impl Default for JS_PersistentRooted {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct a {
pub b: *mut a,
}
-impl Clone for a {
- fn clone(&self) -> Self { *self }
-}
impl Default for a {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
diff --git a/tests/expectations/tests/issue-544-stylo-creduce.rs b/tests/expectations/tests/issue-544-stylo-creduce.rs
index 88cc0d87..fb543cba 100644
--- a/tests/expectations/tests/issue-544-stylo-creduce.rs
+++ b/tests/expectations/tests/issue-544-stylo-creduce.rs
@@ -5,10 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct a {
pub _address: u8,
}
-impl Clone for a {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs b/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs
index 6cf2ba16..c4ce5139 100644
--- a/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs
+++ b/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs
@@ -32,7 +32,7 @@ impl Default for JS_AutoIdVector {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[test]
-fn __bindgen_test_layout_JS_Base_instantiation_16() {
+fn __bindgen_test_layout_JS_Base_instantiation_20() {
assert_eq!(::std::mem::size_of::<JS_Base>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( JS_Base )
));
diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
new file mode 100644
index 00000000..084cdb62
--- /dev/null
+++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
@@ -0,0 +1,38 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct a {
+ pub _address: u8,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct _bindgen_ty_1 {
+ pub ar: a,
+}
+#[test]
+fn bindgen_test_layout__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<_bindgen_ty_1>() , 1usize , concat ! (
+ "Size of: " , stringify ! ( _bindgen_ty_1 ) ));
+ assert_eq! (::std::mem::align_of::<_bindgen_ty_1>() , 1usize , concat ! (
+ "Alignment of " , stringify ! ( _bindgen_ty_1 ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const _bindgen_ty_1 ) ) . ar as * const _ as
+ usize } , 0usize , concat ! (
+ "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
+ , stringify ! ( ar ) ));
+}
+impl Clone for _bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+impl Default for _bindgen_ty_1 {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+extern "C" {
+ #[link_name = "AutoIdVector"]
+ pub static mut AutoIdVector: _bindgen_ty_1;
+}
diff --git a/tests/headers/anonymous-template-types.hpp b/tests/headers/anonymous-template-types.hpp
new file mode 100644
index 00000000..9ada71a9
--- /dev/null
+++ b/tests/headers/anonymous-template-types.hpp
@@ -0,0 +1,24 @@
+// bindgen-flags: -- -std=c++14
+
+template <typename T, typename>
+struct Foo {
+ T t_member;
+};
+
+template <typename U, typename>
+struct Bar {
+ char member;
+};
+
+template <typename, typename V>
+struct Quux {
+ V v_member;
+};
+
+template <typename, typename W>
+struct Lobo {
+ char also_member;
+};
+
+template <typename>
+using AliasWithAnonType = char;
diff --git a/tests/headers/issue-574-assertion-failure-in-codegen.hpp b/tests/headers/issue-574-assertion-failure-in-codegen.hpp
new file mode 100644
index 00000000..b563b4ef
--- /dev/null
+++ b/tests/headers/issue-574-assertion-failure-in-codegen.hpp
@@ -0,0 +1,6 @@
+// bindgen-flags: -- -std=c++14
+
+template <class> class a {};
+class {
+ a<int> ar;
+} AutoIdVector;