Skip to content
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

Bitfields in unions are broken #744

Closed
emilio opened this issue Jun 10, 2017 · 0 comments
Closed

Bitfields in unions are broken #744

emilio opened this issue Jun 10, 2017 · 0 comments

Comments

@emilio
Copy link
Contributor

emilio commented Jun 10, 2017

Also followup from #739.

The following code:

union Foo {
  unsigned int bitfield: 1;
};

Will generate, with the stable rust option:

#[repr(C)]
#[derive(Debug, Copy)]
pub struct Foo {
    pub _bitfield_1: u8,
    pub bindgen_union_field: u32,
}

And with the unstable one:

pub union Foo {
    pub _bitfield_1: u8,
}

We don't have a special path for bitfields in unions, and we should force their offset to be at offset zero, and force alignment and all that.

It's presumably not ultra-hard to fix.

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

No branches or pull requests

3 participants