Fix double declarations with enum bug

This commit is contained in:
Ginger Bill
2016-10-26 12:00:40 +01:00
parent a5c1e83ce4
commit 6996df4104
2 changed files with 4 additions and 4 deletions

View File

@@ -6,5 +6,3 @@ main :: proc() {
v[0] = 123
fmt.println("Hellope!", v, v[0], a)
}

View File

@@ -753,10 +753,12 @@ void check_enum_type(Checker *c, Type *enum_type, Type *named_type, AstNode *nod
add_entity_use(c, f->field, e);
}
gb_sort_array(fields, et->fields.count, cmp_enum_order);
GB_ASSERT(field_index <= et->fields.count);
gb_sort_array(fields, field_index, cmp_enum_order);
enum_type->Record.other_fields = fields;
enum_type->Record.other_field_count = et->fields.count;
enum_type->Record.other_field_count = field_index;
enum_type->Record.enum_count = make_entity_constant(c->allocator, NULL,
make_token_ident(make_string("count")), t_int, make_exact_value_integer(enum_type->Record.other_field_count));