[clang] [clang][docs] Add note about `-Wms-bitfield-padding` in MSVC compatibility docs (PR #155770)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 2 06:32:59 PDT 2026
AaronBallman wrote:
> i don't know where to ask this but is there a direct link to the Microsoft ABI document?
No such document exists in public (that I'm aware of). We basically have to reverse engineer the Microsoft ABI and we can get it wrong.
> The behavior i observed on MSVC was keeping same type in an alignment window while filling all bits of a type, but clang gives this warning even if that is satisfied.
>
> For example this is compatible between MSVC and clang
>
> ```c++
> struct Foo
> {
> uint64_t x: 44;
> uint64_t y: 20;
> //struct alignment is 8 bytes, we filled all uint64_t bits so moving to another type should not be a problem
> uint32_t s; 20;
> uint32_t s; 12;
> //we filled 32 bits of uint32_t but alignment window is not filled so we should still continue with uint32_t
> uint32_t a; ;13;
> uint32_t b ;3;
> uint32_t c; ;13;
> uint32_t d ;3;
> };
> ```
It's possible there are implementation issues in Clang where we don't match the MS ABI exactly (both in terms of layout and in terms of diagnostic behavior).
https://github.com/llvm/llvm-project/pull/155770
More information about the cfe-commits
mailing list