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

MSVC takes required alignment of child types into account #437

Open
Tracked by #387
TwoClocks opened this issue Nov 26, 2022 · 0 comments
Open
Tracked by #387

MSVC takes required alignment of child types into account #437

TwoClocks opened this issue Nov 26, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@TwoClocks
Copy link
Contributor

MSVC seems to walk down the type stack.

__declspec(align(8)) typedef int I1;
__declspec(align(1)) typedef I1 I2;

_Static_assert(sizeof(I1) == 4, "");
_Static_assert(_Alignof(I1) == 8, "");
_Static_assert(sizeof(I2) == 4, "");
_Static_assert(_Alignof(I2) == 8, "");

where GCC/Clang don't

typedef int I1 __attribute__((aligned(8)));
typedef I1 I2 __attribute__((aligned(1)));

_Static_assert(sizeof(I1) == 4, "");
_Static_assert(_Alignof(I1) == 8, "");
_Static_assert(sizeof(I2) == 4, "");
_Static_assert(_Alignof(I2) == 1, "");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants