commit a225cfca23cd9ae3c7a6f17c22d69622ee1d490e
parent b9583a7874367b33bc260eb7dd9178851dfe3cf1
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 19 Feb 2021 13:29:15 -0500
Allow slices to cast to []void
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/types.c b/src/types.c
@@ -565,6 +565,10 @@ type_is_assignable(const struct type *to, const struct type *from)
}
to_secondary = strip_flags(to->array.members, &_to_secondary);
from_secondary = strip_flags(from->array.members, &_from_secondary);
+ if (to->storage == TYPE_STORAGE_SLICE
+ && to_secondary->storage == TYPE_STORAGE_VOID) {
+ return true;
+ }
return to_secondary->id == from_secondary->id;
case TYPE_STORAGE_ARRAY:
return from->storage == TYPE_STORAGE_ARRAY