Skip to content

Behavior change for non-whitelisted types referenced by method #834

@upsuper

Description

@upsuper

Input C/C++ Header

struct T {};
struct U {
  void test(T a);
};

Bindgen Invocation

$ bindgen input.hpp --generate types --whitelist-type U

Actual Results

#[repr(C)]
#[derive(Debug, Copy)]
pub struct U {
    pub _address: u8,
}
#[test]
fn bindgen_test_layout_U() {
    assert_eq!(::std::mem::size_of::<U>() , 1usize , concat ! (
               "Size of: " , stringify ! ( U ) ));
    assert_eq! (::std::mem::align_of::<U>() , 1usize , concat ! (
                "Alignment of " , stringify ! ( U ) ));
}
impl Clone for U {
    fn clone(&self) -> Self { *self }
}

Expected Results

Not really expected result, but before #827, it generates

#[repr(C)]
#[derive(Debug, Copy)]
pub struct T {
    pub _address: u8,
}
#[test]
fn bindgen_test_layout_T() {
    assert_eq!(::std::mem::size_of::<T>() , 1usize , concat ! (
               "Size of: " , stringify ! ( T ) ));
    assert_eq! (::std::mem::align_of::<T>() , 1usize , concat ! (
                "Alignment of " , stringify ! ( T ) ));
}
impl Clone for T {
    fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct U {
    pub _address: u8,
}
#[test]
fn bindgen_test_layout_U() {
    assert_eq!(::std::mem::size_of::<U>() , 1usize , concat ! (
               "Size of: " , stringify ! ( U ) ));
    assert_eq! (::std::mem::align_of::<U>() , 1usize , concat ! (
                "Alignment of " , stringify ! ( U ) ));
}
impl Clone for U {
    fn clone(&self) -> Self { *self }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions