The gcc manual does not describe the behaviour of __attribute__((packed)) attached to a class definition, e.g.
As far as I have observed, the behaviour is the same if foo would be declared as struct. The gcc manual describes packed only for variables, structs and enums.
Class and structs are the same by definition of the C++ standard. The only different is the default accessibility, private for class and public for struct.
Confirmed, more of the issue is really the documenation is more C based than C++ based.