public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56155] New: [C++0X] enumeration with fixed underlying type - enum literals have wrong type
@ 2013-01-30 16:29 mib.bugzilla at gmail dot com
  2013-01-30 17:35 ` [Bug c++/56155] [C++0X] enumeration with fixed underlying type - enumerators have wrong type within enumerator-list redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mib.bugzilla at gmail dot com @ 2013-01-30 16:29 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56155

             Bug #: 56155
           Summary: [C++0X] enumeration with fixed underlying type - enum
                    literals have wrong type
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mib.bugzilla@gmail.com


For an enumeration whose underlying type is fixed, the values of the
enumeration are the values of the underlying type. gcc appears to be ignoring
the underlying type, as the value of E_ in this example is 4

 gpp48 bug1.cpp -std=c++0x
bug1.cpp: In function âint main()â:
bug1.cpp:4:3: error: static assertion failed: E_ should be 1
   static_assert( E_ == 1, "E_ should be 1");
   ^

enum e_ : unsigned char { Z_, E_=sizeof(Z_) };
#include <stdio.h>
int main(void) {
  static_assert( E_ == 1, "E_ should be 1");
  printf("z is %d e is %d\n", Z_, E_ ); // prints 4
  printf("sizeof unsigned char is %d\n", sizeof(unsigned char)); // prints 1
  printf("sizeof e_ is %d\n", sizeof(e_)); // prints 1
  return 0;
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-15 19:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-30 16:29 [Bug c++/56155] New: [C++0X] enumeration with fixed underlying type - enum literals have wrong type mib.bugzilla at gmail dot com
2013-01-30 17:35 ` [Bug c++/56155] [C++0X] enumeration with fixed underlying type - enumerators have wrong type within enumerator-list redi at gcc dot gnu.org
2013-01-30 19:00 ` [Bug c++/56155] [C++11] " paolo.carlini at oracle dot com
2013-01-30 19:16 ` paolo.carlini at oracle dot com
2013-02-13 17:56 ` jason at gcc dot gnu.org
2013-02-15 19:27 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).