Forbid enum redefinition.

Prevent the following code from compiling:

enum color {RED, GREEN, BLUE};
enum color {R, G, B};

int main()
{
        return R;
}

Reported-by: John Haque <j.eh@mchsi.com>
master
Thomas Preud'homme 2013-09-20 01:06:43 +02:00
parent a465b7f58f
commit 0f522fb32a
1 changed files with 1 additions and 0 deletions

View File

@ -2801,6 +2801,7 @@ static void struct_decl(CType *type, int u)
if (tok == '}')
break;
}
s->c = type_size(&int_type, &align);
skip('}');
} else {
maxalign = 1;