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/36113] New: fix C enumerators


For compatibility with C++ and more reasonable GNU semantics, would we place
make the below program not print 0.  Essentially, the type of all the
enumerators should be the underlying type of the enum, not the type that fits
the init.

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>

int main(void) {
  enum {
    dummy = (1ULL<<63),
    SomeConstant = 0x1
  } MyEnum;

#define MY_MACRO(value) ((value) << 60)

  printf("MY_MACRO(SomeConstant) == 0x%llx.\n", MY_MACRO(SomeConstant));

  return 0;
}


-- 
           Summary: fix C enumerators
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mrs at apple dot com


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


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