Closed stolk closed 1 year ago
Same results when using clang-13 instead of gcc-11.
Note: unit test is skipped when building RELEASE, so I am guessing most people never build as DEBUG? I will make a PR for this.
Well that is curious, the code does:
#ifndef __APPLE__ // Apple Clang, unlike Clang on Linux and all other compilers, decides to ignore pragma pack?
assert(sizeof(small_vector<int, 2>) == 12);
#endif
that code relies on #pragma pack(push, 2)
doing the right thing, which has worked for Clang 12 and GCC 10.. are these newer compilers suddenly agreeing to ignore it?
Ah our CI does run in Release
, maybe it never worked..
This should have fired on windows, too.
struct packing rules in C:
For struct, other than the alignment need for each individual member, the size of whole struct itself will be aligned to a size divisible by strictest alignment requirement of any of its members, by padding at end.
I added a linux check to the APPLE one, but frankly, I would just remove the entire assert?
Visual C++ should have tripped on this too?
VC++ still does work as intended, but yeah we can comment out the entire assert for now.. I'll need to think of a different way of doing this or just give up on trying to save 4 bytes :)
Building with gcc-11 on Ubuntu: