summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-10-28 13:22:35 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-10-28 13:22:47 +0200
commit0630f467760671cdfa73c4f12422275280448312 (patch)
treed7dba406e9d4f1c014269cc6316c47c076f09cc4
parenta57d880c493bab4fd851e778badfef62c77fd235 (diff)
ir: References have no implicit template parameters.
Fixes #1113.
-rw-r--r--src/codegen/mod.rs2
-rw-r--r--tests/expectations/tests/issue-1113-template-references.rs38
-rw-r--r--tests/headers/issue-1113-template-references.hpp16
3 files changed, 55 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 6c1ed02f..53ed24ff 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -268,6 +268,7 @@ impl AppendImplicitTemplateParams for quote::Tokens {
TypeKind::Void |
TypeKind::NullPtr |
TypeKind::Pointer(..) |
+ TypeKind::Reference(..) |
TypeKind::Int(..) |
TypeKind::Float(..) |
TypeKind::Complex(..) |
@@ -280,7 +281,6 @@ impl AppendImplicitTemplateParams for quote::Tokens {
TypeKind::ObjCId |
TypeKind::ObjCSel |
TypeKind::TemplateInstantiation(..) => return,
-
_ => {},
}
diff --git a/tests/expectations/tests/issue-1113-template-references.rs b/tests/expectations/tests/issue-1113-template-references.rs
new file mode 100644
index 00000000..3430f27d
--- /dev/null
+++ b/tests/expectations/tests/issue-1113-template-references.rs
@@ -0,0 +1,38 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Entry<K, V> {
+ pub _base: K,
+ pub mData: V,
+ pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<K>>,
+ pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
+}
+impl<K, V> Default for Entry<K, V> {
+ fn default() -> Self {
+ unsafe { ::std::mem::zeroed() }
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct nsBaseHashtable {
+ pub _address: u8,
+}
+pub type nsBaseHashtable_EntryType<K, V> = Entry<K, V>;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsBaseHashtable_EntryPtr<K, V> {
+ pub mEntry: *mut nsBaseHashtable_EntryType<K, V>,
+ pub mExistingEntry: bool,
+ pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<K>>,
+ pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
+}
+impl<K, V> Default for nsBaseHashtable_EntryPtr<K, V> {
+ fn default() -> Self {
+ unsafe { ::std::mem::zeroed() }
+ }
+}
diff --git a/tests/headers/issue-1113-template-references.hpp b/tests/headers/issue-1113-template-references.hpp
new file mode 100644
index 00000000..46339c5d
--- /dev/null
+++ b/tests/headers/issue-1113-template-references.hpp
@@ -0,0 +1,16 @@
+template<class K, class V>
+class Entry : public K
+{
+ V mData;
+};
+
+template<typename K, typename V>
+class nsBaseHashtable {
+ typedef Entry<K, V> EntryType;
+
+ struct EntryPtr {
+ private:
+ EntryType& mEntry;
+ bool mExistingEntry;
+ };
+};