Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ir: References have no implicit template parameters. #1114

Merged
merged 1 commit into from
Oct 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/codegen/mod.rs
Original file line number Diff line number Diff line change
@@ -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,

_ => {},
}

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;
};
};