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

ruilvo at ua dot pt gcc-bugzilla@gcc.gnu.org
Mon Jan 9 21:23:51 GMT 2023


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108342

--- Comment #10 from Rui Oliveira <ruilvo at ua dot pt> ---
So my options are to create like a placeholder, say 

```c
typedef struct __attribute__((__packed__)) // Packed isn't really necessary
here I think?
{
    float re, im;
} ph_fcomplex_t

```

To silence the warning and get packing to work, and trust
[complex.numbers.general] for a reinterpret_cast into std::complex<float> I
guess.


More information about the Gcc-bugs mailing list