commit 85226e92ba954d79e1325669c8855c0ca8459029
parent 6b88b5381e79703df7e600e77a4f314eb8a236e0
Author: Eyal Sawady <ecs@d2evs.net>
Date: Sun, 7 Nov 2021 14:02:34 +0000
Fix infinite loop on invalid enum value
And fix a typo in a related error message
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/type_store.c b/src/type_store.c
@@ -642,11 +642,15 @@ type_init_from_atype(struct type_store *store,
if (r != EVAL_OK) {
error(store->check_context, atype->loc,
"Cannot evaluate enum value at compile time");
+ values = &value->next;
+ avalue = avalue->next;
continue;
}
if (!type_is_assignable(storage, out.result)) {
error(store->check_context, atype->loc,
- "Cannotg assign enum value to enum type");
+ "Cannot assign enum value to enum type");
+ values = &value->next;
+ avalue = avalue->next;
continue;
}
if (type_is_signed(storage)) {