If I have a packed struct and try to pass a member variable by reference to a function call, I get the "error: cannot bind packed field" message. If I explicitly create a reference to the member variable first and pass that, things work fine. One of these behaviors must be incorrect.
This issue also exists under gcc 4.0.1 (same host/target/build triplet as above) and gcc 4.1.2 under Linux. Under gcc 3.3.3 (on Linux), there was no error. Here is code which demonstrates the issue: struct Squeeze { short s; } __attribute__((aligned(1), packed)); void VerticallyChallenged(short&) {} int main() { Squeeze oj; short& pit(oj.s); VerticallyChallenged(pit); // okay VerticallyChallenged(oj.s); // cannot bind packed field oj.Squeeze::s to short int& } -- Summary: Cannot bind packed field Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nevin at eviloverlord dot com GCC build triplet: i686-apple-darwin9 GCC host triplet: i686-apple-darwin9 GCC target triplet: i686-apple-darwin9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36566