Skip to content

layout test fail on class Base { int a; bool b; }; class Foo : public Base { bool c; }; #404

New issue

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

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

Already on GitHub? Sign in to your account

Closed
kkimdev opened this issue Jan 18, 2017 · 2 comments

Comments

@kkimdev
Copy link

kkimdev commented Jan 18, 2017

C++ header:

class Base {
  int a;
  bool b;
};

class Foo : public Base {
  bool c;
};

Generated test:

#[test]
fn bindgen_test_layout_Foo() {
    assert_eq!(::std::mem::size_of::<Foo>() , 8usize);
    assert_eq!(::std::mem::align_of::<Foo>() , 4usize);
}

Test output:

'assertion failed: `(left == right)` (left: `12`, right: `8`)',

Please let me know in case it's not reproducible.

@kkimdev kkimdev changed the title layout test fail on class Base { int a; bool b; }; class Foo : public Base { bool c; }; layout test fail on class Base { int a; bool b; }; class Foo : public Base { bool c; }; Jan 18, 2017
@emilio
Copy link
Contributor

emilio commented Jan 18, 2017

Yup, this is a dupe of #380, thanks for reporting it. My intuition is that solving this for code without template parameters may be relatively straight-forward, but with templates we need to be more careful.

Going to close this as a dupe, but I have it on my radar.

Thanks again for reporting it! :)

@emilio emilio closed this as completed Jan 18, 2017
@fitzgen
Copy link
Member

fitzgen commented Jan 19, 2017

Also, thanks for the descriptive and concise bug report :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants