With GCC 4.7 and the following program:
--
struct byte
{
unsigned char _;
byte () = default;
explicit operator unsigned char () { return _; }
};
struct wyde
{
unsigned short _;
wyde () = default;
constexpr wyde (unsigned short r) : _(r) { }
};
struct foo
{
byte one;
wyde two;
}
__attribute__((packed));
auto main (int argc, char * argv[]) -> int
{
foo f;
return 0;
}
--
I am receiving this warning:
../main.cpp:22:8: warning: ignoring packed attribute because of unpacked
non-POD field ‘wyde foo::two’ [enabled by default]
Should this decision be adjusted to take trivial types into account?
--
P.