commit 07363598fb305c3d9115c4f03f0aa184c147f9b0 parent d73557f1362ed831964af0e3ee3a6d92f2f5ad29 Author: Drew DeVault <sir@cmpwn.com> Date: Sat, 23 Jan 2021 15:46:33 -0500 type store: fix error in string casting rules Diffstat:
M | src/type_store.c | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/type_store.c b/src/type_store.c @@ -261,8 +261,9 @@ type_is_castable(const struct type *to, const struct type *from) case TYPE_STORAGE_TAGGED_UNION: return tagged_castable(to, from); case TYPE_STORAGE_STRING: - return to->pointer.referent->storage == TYPE_STORAGE_CHAR - && to->pointer.referent->flags & TYPE_CONST; + return to->storage == TYPE_STORAGE_POINTER + && to->pointer.referent->storage == TYPE_STORAGE_CHAR + && to->pointer.referent->flags & TYPE_CONST; case TYPE_STORAGE_RUNE: return to->storage == TYPE_STORAGE_U32; // Cannot be cast: