mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Bitstruct accidentally allowed other arrays than char arrays #2836
This commit is contained in:
@@ -1107,11 +1107,10 @@ static bool sema_analyse_bitstruct(SemaContext *context, Decl *decl, bool *erase
|
||||
decl->strukt.little_endian = false;
|
||||
}
|
||||
Type *base_type = type->type_kind == TYPE_ARRAY ? type_flatten(type->array.base) : type;
|
||||
if (!type_is_integer(base_type))
|
||||
if (!type_is_integer(base_type) || (type->type_kind == TYPE_ARRAY && type_size(type->array.base) > 1))
|
||||
{
|
||||
SEMA_ERROR(decl->strukt.container_type, "The type of the bitstruct cannot be %s but must be an integer or an array of integers.",
|
||||
type_quoted_error_string(decl->strukt.container_type->type));
|
||||
return false;
|
||||
RETURN_SEMA_ERROR(decl->strukt.container_type, "The type of the bitstruct cannot be %s but must be an integer or an array of chars.",
|
||||
type_quoted_error_string(decl->strukt.container_type->type));
|
||||
}
|
||||
Decl **members = decl->strukt.members;
|
||||
unsigned member_count = vec_size(members);
|
||||
|
||||
Reference in New Issue
Block a user