commit 4e8d5e57ee57c83907b996d5a6740f9784818db0
parent 9351585b504decfc316225cbf80954f0c7d27970
Author: Eyal Sawady <ecs@d2evs.net>
Date: Sat, 18 Sep 2021 22:44:42 +0000
Allow fields with offset 0
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/type_store.c b/src/type_store.c
@@ -189,9 +189,9 @@ struct_insert_field(struct type_store *store, struct struct_field **fields,
} else if (!type_is_integer(out.result)) {
error(store->check_context, in.loc,
"Field offset must be an integer");
- } else if (type_is_signed(out.result) && out.constant.ival <= 0) {
+ } else if (type_is_signed(out.result) && out.constant.ival < 0) {
error(store->check_context, in.loc,
- "Field offset must be greater than 0");
+ "Field offset must not be less than 0");
} else {
size_t offs = (size_t)out.constant.uval;
field->offset = offs;