Hi.

Noticed couple of issues with enums.

[1] tcc silently accepts enum redifinition.

$ tcc -run -
enum color { RED=10, GREEN, BLUE };
enum color { R, G, B };
int main()
{
        enum color c=RED, d=R;
        printf("c=%d,d=%d\n", c, d);
        return 0;
}
c=10,d=0


[2] no error reported when using undefined enum.

$ tcc -run -
enum color { RED, GREEN, BLUE };
int main()
{
        enum rgb c=BLUE;        /* undefined enum */
        enum color d=GREEN;
        printf("c=%d,d=%d\n", c, d);
        return 0;
}
c=2,d=1

I was using the source from the mob branch.


Thanks.

John

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to