Skip to content

Commit

Permalink
ir: References have no implicit template parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Oct 28, 2017
1 parent a57d880 commit 0630f46
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl AppendImplicitTemplateParams for quote::Tokens {
TypeKind::Void |
TypeKind::NullPtr |
TypeKind::Pointer(..) |
TypeKind::Reference(..) |
TypeKind::Int(..) |
TypeKind::Float(..) |
TypeKind::Complex(..) |
Expand All @@ -280,7 +281,6 @@ impl AppendImplicitTemplateParams for quote::Tokens {
TypeKind::ObjCId |
TypeKind::ObjCSel |
TypeKind::TemplateInstantiation(..) => return,

_ => {},
}

Expand Down
38 changes: 38 additions & 0 deletions tests/expectations/tests/issue-1113-template-references.rs
Original file line number Diff line number Diff line change
@@ -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() }
}
}
16 changes: 16 additions & 0 deletions tests/headers/issue-1113-template-references.hpp
Original file line number Diff line number Diff line change
@@ -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;
};
};

0 comments on commit 0630f46

Please sign in to comment.