commit 71d3eb72cc7e225083a8f008e2608ca79f6d2e76
parent aebcb0e52f522914627ad81d823c684c8a62aa6e
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 30 Dec 2020 15:59:03 -0500
Allow str to be assigned from *const char
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/type_store.c b/src/type_store.c
@@ -92,6 +92,8 @@ type_is_assignable(struct type_store *store,
case TYPE_STORAGE_ENUM:
case TYPE_STORAGE_TAGGED_UNION:
assert(0); // TODO
+ case TYPE_STORAGE_STRING:
+ return to == &builtin_type_const_ptr_char;
// The following types are only assignable from themselves, and are
// handled above:
case TYPE_STORAGE_ARRAY:
@@ -101,7 +103,6 @@ type_is_assignable(struct type_store *store,
case TYPE_STORAGE_NULL:
case TYPE_STORAGE_RUNE:
case TYPE_STORAGE_SLICE:
- case TYPE_STORAGE_STRING:
case TYPE_STORAGE_STRUCT:
case TYPE_STORAGE_UNION:
case TYPE_STORAGE_VOID: