summaryrefslogtreecommitdiff
path: root/libbindgen/tests
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2016-12-15 18:02:49 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2016-12-15 18:02:49 +0100
commit1129431b00cb3ab76dce0ab8b2956d319d939f3a (patch)
treeb4c6e649f43f50d692ad2b203ce31c5eb784175e /libbindgen/tests
parent59987f142bbd97e44437532a640eb66c4d3a3e52 (diff)
ir: Don't parse constructors twice.
Diffstat (limited to 'libbindgen/tests')
-rw-r--r--libbindgen/tests/expectations/tests/constructor-tp.rs37
-rw-r--r--libbindgen/tests/headers/constructor-tp.hpp19
2 files changed, 56 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/constructor-tp.rs b/libbindgen/tests/expectations/tests/constructor-tp.rs
new file mode 100644
index 00000000..50220489
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/constructor-tp.rs
@@ -0,0 +1,37 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Foo<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 1usize);
+}
+extern "C" {
+ #[link_name = "_ZN3BarC1Ev"]
+ pub fn Bar_Bar(this: *mut Bar);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
+impl Bar {
+ #[inline]
+ pub unsafe fn new() -> Self {
+ let mut __bindgen_tmp = ::std::mem::uninitialized();
+ Bar_Bar(&mut __bindgen_tmp);
+ __bindgen_tmp
+ }
+}
diff --git a/libbindgen/tests/headers/constructor-tp.hpp b/libbindgen/tests/headers/constructor-tp.hpp
new file mode 100644
index 00000000..7a420413
--- /dev/null
+++ b/libbindgen/tests/headers/constructor-tp.hpp
@@ -0,0 +1,19 @@
+
+template<typename T>
+class Foo {
+public:
+ Foo();
+};
+
+class Bar {
+public:
+ Bar();
+};
+
+template<typename T>
+Foo<T>::Foo() {
+}
+
+inline
+Bar::Bar() {
+}