[Bug c/21899] New: enum definition accepts values to be overriden
g dot bloisi at iontrading dot com
gcc-bugzilla@gcc.gnu.org
Fri Jun 3 14:04:00 GMT 2005
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
More information about the Gcc-bugs
mailing list