This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52085] incomplete enum not completed correctly if packed was used
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 02 Feb 2012 06:22:18 +0000
- Subject: [Bug c/52085] incomplete enum not completed correctly if packed was used
- Auto-submitted: auto-generated
- References: <bug-52085-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52085
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-02-02
Summary|sizeof packed enum can vary |incomplete enum not
|without warning depending |completed correctly if
|on include order |packed was used
Ever Confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-02 06:22:18 UTC ---
I take that back, incomplete types are invalid here as long as you don't use
the function. So confirmed.
Here is a short testcase:
enum name func(void);
enum name { val = 1} __attribute__ ((__packed__));
enum name1 { val1 = 1 } __attribute__((__packed__));
int f[(sizeof (enum name1) == sizeof (enum name))?1:-1];
--- CUT ---
The above one should compile without error.