Bug 25759 - Documentation not clear, attribute packed on class in C++
Summary: Documentation not clear, attribute packed on class in C++
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2006-01-12 09:05 UTC by Frank Mehnert
Modified: 2018-11-16 00:53 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-02 19:51:35


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Mehnert 2006-01-12 09:05:24 UTC
The gcc manual does not describe the behaviour of __attribute__((packed)) attached to a class definition, e.g.

  class foo
  {
    unsigned char;
    unsigned long;
  } __attribute__((packed));

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.
Comment 1 Andrew Pinski 2006-01-12 12:53:19 UTC
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.
Comment 2 Andrew Pinski 2006-02-02 19:51:35 UTC
Confirmed, more of the issue is really the documenation is more C based than C++ based.
Comment 3 sandra 2018-11-16 00:51:13 UTC
Author: sandra
Date: Fri Nov 16 00:50:41 2018
New Revision: 266199

URL: https://gcc.gnu.org/viewcvs?rev=266199&root=gcc&view=rev
Log:
2018-11-15  Sandra Loosemore  <sandra@codesourcery.com>

	PR c++/25759

	gcc/
	* doc/extend.texi (Common Type Attributes): Make it explicit
	that attribute "packed" can apply to C++ classes.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/extend.texi
Comment 4 sandra 2018-11-16 00:53:24 UTC
Fixed on trunk.