[Bug libstdc++/108342] std::complex: ignoring packed attribute because of unpacked non-POD field

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 9 16:17:34 GMT 2023


--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I don't think there's anything the library can do here. The layout of
std::complex is fixed, as stated above. And the fact it's a non-POD is also

If the front-end warns about trying to pack a non-POD, then the library can't
stop it warning about std::complex<float>.

I don't know whether clang allows packing non-PODs, or just doesn't ever warn
for them, or has a special case for std::complex, or does something smarter
like not warn for types that have no padding bytes anyway (so that packing them
would be a no-op).

More information about the Gcc-bugs mailing list