harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 345b92503b00b4e528d5b3a4e57c9699ae0147f5
parent a5ae7ef30f047c3cb4ad6946084ed0c8fb64208f
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu, 11 Mar 2021 11:52:40 -0500

Loosen assignment rules for non-tagged

Diffstat:
Msrc/type_store.c | 1-
Msrc/types.c | 5+++++
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/type_store.c b/src/type_store.c @@ -164,7 +164,6 @@ struct_insert_field(struct type_store *store, struct struct_field **fields, if (atype->offset) { *ccompat = false; - assert(storage == STORAGE_STRUCT); // TODO: Bubble up struct expression in, out; check_expression(store->check_context, atype->offset, &in, NULL); enum eval_result r = eval_expr(store->check_context, &in, &out); diff --git a/src/types.c b/src/types.c @@ -499,6 +499,11 @@ tagged_subset_compat(const struct type *to, const struct type *from) bool type_is_assignable(const struct type *to, const struct type *from) { + if (type_dealias(to)->storage != STORAGE_TAGGED) { + to = type_dealias(to); + from = type_dealias(from); + } + // const and non-const types are mutually assignable struct type _to, _from; const struct type *from_orig = from;