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

[basic.align] p1 The alignment of a bit-field and that of its declared type #649

Open
xmh0511 opened this issue Dec 5, 2024 · 0 comments

Comments

@xmh0511
Copy link

xmh0511 commented Dec 5, 2024

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[basic.align] p1 says:

An object type imposes an alignment requirement on every object of that type;

[class.bit] p1 says:

Alignment of bit-fields is implementation-defined.

Consider this example:

struct A{
 char a: 2;
 int b:3
};

[basic.align] p1 says the alignment requirement of int imposes on every object, including the bit-field. However, [class.bit] p1 says the alignment of A::b is implementation-defined. So, is the alignment of A::b a union of them, or just is implementation defined?

Suggested Resolution:

An object type imposes an alignment requirement on every object of that type other than bit-field;

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

1 participant