Commit 354ec35b3ce5b029a22f8674048cdc6bbda7e15e

Thomas de Grivel 2023-10-27T15:06:12

wip arrays

diff --git a/libc3/array.c b/libc3/array.c
index c7f5521..764af7b 100644
--- a/libc3/array.c
+++ b/libc3/array.c
@@ -184,6 +184,7 @@ s_tag * array_data_tag (s_tag *a, const s_tag *address, s_tag *dest)
                            address->data.array.data))) {
     tag_init(dest);
     copy = array_type_to_copy(a->data.array.type);
+    sym_to_tag_type(a->data.array.type, &dest->type);
     dest_data = tag_to_pointer(dest, a->data.array.type);
     if (copy(a_data, dest_data) != dest_data)
       return NULL;
diff --git a/libc3/tag.c b/libc3/tag.c
index cf368dc..3648740 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -8456,9 +8456,10 @@ void * tag_to_pointer (s_tag *tag, const s_sym *type)
   e_tag_type tag_type;
   sym_to_tag_type(type, &tag_type);
   if (tag->type != tag_type) {
-    warnx("tag_to_pointer: cannot cast %s to %s",
-          tag_type_to_sym(tag->type)->str.ptr.ps8,
-          type->str.ptr.ps8);
+    assert(! "tag_to_pointer: cannot cast");
+    errx(1, "tag_to_pointer: cannot cast %s to %s",
+         tag_type_to_sym(tag->type)->str.ptr.ps8,
+         type->str.ptr.ps8);
     return NULL;
   }
   switch (tag->type) {