Commit 8b28358adf7baeafae829246433eb14513636839

Thomas de Grivel 2024-08-29T12:37:44

struct_type_size: var

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/libkc3/struct_type.c b/libkc3/struct_type.c
index 8514fe7..1ae6b5e 100644
--- a/libkc3/struct_type.c
+++ b/libkc3/struct_type.c
@@ -128,7 +128,15 @@ s_struct_type * struct_type_init (s_struct_type *st,
       return NULL;
     }
     tuple = &s->tag.data.tuple;
-    if (! tag_size(tuple->tag + 1, &size)) {
+    if (tuple->tag[1].type == TAG_VAR) {
+      type = tuple->tag[1].data.var.type;
+      if (! sym_type_size(&type, &size)) {
+        map_clean(&tmp.map);
+        free(tmp.offset);
+        return NULL;
+      }
+    }
+    else if (! tag_size(tuple->tag + 1, &size)) {
       map_clean(&tmp.map);
       free(tmp.offset);
       return NULL;