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

Reply via email to