commit 53965de78675b1b477d032c617f36422aebf91d3
parent 6b8611115c60b6526d4c6958328b2e03ae96247a
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 1 Feb 2021 16:38:27 -0500
types: fix oversights in slice assignment
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/types.c b/src/types.c
@@ -481,10 +481,13 @@ type_is_assignable(const struct type *to, const struct type *from)
case TYPE_STORAGE_VOID:
return true;
case TYPE_STORAGE_SLICE:
+ if (from->storage != TYPE_STORAGE_ARRAY
+ && from->storage != TYPE_STORAGE_SLICE) {
+ return false;
+ }
to_secondary = strip_flags(to->array.members, &_to_secondary);
from_secondary = strip_flags(from->array.members, &_from_secondary);
- return (from->storage == TYPE_STORAGE_ARRAY || from->storage == TYPE_STORAGE_SLICE)
- && to_secondary->id == from_secondary->id;
+ return to_secondary->id == from_secondary->id;
case TYPE_STORAGE_ARRAY:
return from->storage == TYPE_STORAGE_ARRAY
&& to->array.length == SIZE_UNDEFINED