[clang] [Clang][Windows] Preserve x86_fp80 and vector alignment under #pragma pack. (PR #208256)

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 13:01:20 PDT 2026


zahiraam wrote:

> > MSVC always uses 64-bit `long double`. I don't know anything about attempts to use 80-bit `long double` on Windows except that they're asking for tons of complexity.
> 
> Right, that was what I thought (a few years ago I was _very_ jealous of win64 making that choice).
> 
> To understand what clang might be doing wrong, what happens if someone were to do something along the lines of (stealing from original failure) this?
> 
> ```c++
> #include <array>                                                                        
> struct Klass { some_overaligned_type_t field; };
>                                                                                         
> void test() {                                                                           
>   std::array<Klass, 16> matrix;
>   matrix.fill({}); 
> } 
> ```
> 
> would that be expected to work?

 Yes, with this patch, `std::array<Klass, overaligned_type>` works correctly and gets the proper alignment  
  even with `#pragma pack`.

https://github.com/llvm/llvm-project/pull/208256


More information about the cfe-commits mailing list