The code below with gcc compiles and the exe prints "Value: 3".
With g++, instead, the compilation fails with the following error:
main.c:7: error: redefinition of `A'
main.c:4: error: `A' previously defined here

Regards,
Giambattista Bloisi

----
#include <stdio.h>

typedef enum {
        A = 1,
        B = 2,
        A
} myenum;

int main() {
        myenum a = A;

        printf("Value: %d\n", (int)a);
return 0;
}

-- 
           Summary: enum definition accepts values to be overriden
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: g dot bloisi at iontrading dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to