mstorsjo wrote: > Microsoft bit-field layout didn't break an overly-specific regression test > but rendered unusable double to string conversion. The culprit was the > following snippet: > > ```c++ > union Extractor { > double value; > struct { > bool sign : 1; > u32 exponent : 11; > u64 mantissa : 52; > }; > }; > ``` > > According to MSVC ABI, there should be padding between fields. I hope you > agree that this is not an intuitive and expected behavior.
It is indeed an unexpected thing. However it is possible to work around it for all these cases; if you declare the inner structure like this: ``` struct { u64 sign : 1; u64 exponent : 11; u64 mantissa : 52; }; ``` Then there will be no extra padding between the fields. https://github.com/llvm/llvm-project/pull/71148 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits