Skip to content

Improper virtual method tracking with template parameters. #691

@emilio

Description

@emilio

Input C/C++ Header

class VirtualMethods {
  virtual void foo();
};

template<typename K>
class Set {
  int bar;
};

class ServoElementSnapshotTable
  : public Set<VirtualMethods>
{};

Bindgen Invokation

$ bindgen input.h

Actual Results

/* automatically generated by rust-bindgen */

#[repr(C)]
pub struct VirtualMethods__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
#[derive(Debug, Copy)]
pub struct VirtualMethods {
    pub vtable_: *const VirtualMethods__bindgen_vtable,
}
#[test]
fn bindgen_test_layout_VirtualMethods() {
    assert_eq!(::std::mem::size_of::<VirtualMethods>() , 8usize , concat ! (
               "Size of: " , stringify ! ( VirtualMethods ) ));
    assert_eq! (::std::mem::align_of::<VirtualMethods>() , 8usize , concat ! (
                "Alignment of " , stringify ! ( VirtualMethods ) ));
}
impl Clone for VirtualMethods {
    fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Set {
    pub bar: ::std::os::raw::c_int,
}
#[repr(C)]
pub struct ServoElementSnapshotTable__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ServoElementSnapshotTable {
    pub vtable_: *const ServoElementSnapshotTable__bindgen_vtable,
    pub _base: Set,
}
#[test]
fn bindgen_test_layout_ServoElementSnapshotTable() {
    assert_eq!(::std::mem::size_of::<ServoElementSnapshotTable>() , 4usize ,
               concat ! (
               "Size of: " , stringify ! ( ServoElementSnapshotTable ) ));
    assert_eq! (::std::mem::align_of::<ServoElementSnapshotTable>() , 4usize ,
                concat ! (
                "Alignment of " , stringify ! ( ServoElementSnapshotTable )
                ));
}
impl Clone for ServoElementSnapshotTable {
    fn clone(&self) -> Self { *self }
}
#[test]
fn __bindgen_test_layout_Set_instantiation_13() {
    assert_eq!(::std::mem::size_of::<Set>() , 4usize , concat ! (
               "Size of template specialization: " , stringify ! ( Set ) ));
    assert_eq!(::std::mem::align_of::<Set>() , 4usize , concat ! (
               "Alignment of template specialization: " , stringify ! ( Set )
               ));
}

Expected Results

ServoElementSnapshotTable should have no vtable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions