This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52085] incomplete enum not completed correctly if packed was used


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]