|
@@ -986,8 +986,8 @@ void check_bit_set_type(CheckerContext *c, Type *type, Type *named_type, Ast *no
|
|
|
error(bs->elem, "Enum type for bit_set must be an integer");
|
|
|
return;
|
|
|
}
|
|
|
- i64 lower = 0;
|
|
|
- i64 upper = 0;
|
|
|
+ i64 lower = I64_MAX;
|
|
|
+ i64 upper = I64_MIN;
|
|
|
|
|
|
for_array(i, et->Enum.fields) {
|
|
|
Entity *e = et->Enum.fields[i];
|
|
@@ -1001,6 +1001,10 @@ void check_bit_set_type(CheckerContext *c, Type *type, Type *named_type, Ast *no
|
|
|
lower = gb_min(lower, x);
|
|
|
upper = gb_max(upper, x);
|
|
|
}
|
|
|
+ if (et->Enum.fields.count == 0) {
|
|
|
+ lower = 0;
|
|
|
+ upper = 0;
|
|
|
+ }
|
|
|
|
|
|
GB_ASSERT(lower <= upper);
|
|
|
|