harec

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

commit ce9373218c0d9999fd6bab81d07ac3bcdb816999
parent c153a9fd3d495d2d297c1d38ef706880800a15a9
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu, 25 Feb 2021 16:54:23 -0500

types: improve alias handling on slice cast

Diffstat:
Msrc/types.c | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/types.c b/src/types.c @@ -571,12 +571,17 @@ type_is_assignable(const struct type *to, const struct type *from) case STORAGE_VOID: return true; case STORAGE_SLICE: + from = type_dealias(from); if (from->storage != STORAGE_ARRAY && from->storage != STORAGE_SLICE) { return false; } - to_secondary = strip_flags(to->array.members, &_to_secondary); - from_secondary = strip_flags(from->array.members, &_from_secondary); + to_secondary = strip_flags( + type_dealias(to->array.members), + &_to_secondary); + from_secondary = strip_flags( + type_dealias(from->array.members), + &_from_secondary); if (to->storage == STORAGE_SLICE && to_secondary->storage == STORAGE_VOID) { return true;