https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68160
Bug ID: 68160 Summary: Can bind packed field if it's packed with #pragma pack(push, 1) Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: csaftoiu at gmail dot com Target Milestone: --- Consider the following code (http://coliru.stacked-crooked.com/a/b134364f7e775f87): #pragma pack(push, 1) struct foo1 { char a; int b; }; #pragma pack(pop) struct foo2 { char a; int b; } __attribute__((__packed__, aligned(1) )); int main() { foo1 f1; foo2 f2; int& i1 = f1.b; // (1) ok int& i2 = f2.b; // (2) cannot bind packed field 'f2.foo2::b' to 'int&' return 0; } (1) is valid, yet (2) produces the error. Shouldn't these behave exactly the same way, namely, (1) should also produce an error?